6

I am creating a new web project in Google Analytics.

  1. Why am i getting a Measurement iD instead of Tracking ID?
  2. How can i connect Measurement ID with React JS?
  3. Can i give localhost URL in website URL?

I have added below code in my App.js but it is not getting integrated with Google Analytics

useEffect(() => {
  ReactGA.initialize('G-*******SYL');
  ReactGA.pageview('/');
}, [])
0

2 Answers 2

8

I suggest you create a Universal Analytics Property (as shown in following image) and use the relative identifier UA-XXXXXXX-X because Google Analytics 4 Property ID (G-XXXXXXXX) currently has the measurement protocol in alpha version, also React does not support it yet:

enter image description here

3
  • It gives you the option to create both a G and UA property at the same time. Commented Jun 22, 2021 at 5:23
  • It is deprecated soon! Commented Mar 23, 2022 at 16:45
  • 1
    Yes, in July 2023. Commented Mar 23, 2022 at 20:05
-2

Create a new property, with selected "Create a Universal Analytics property". It'll show you tracking id.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.