[英]Integrate Google Analytics Measurement Id with React JS
I am creating a new web project in Google Analytics.我正在 Google Analytics 中创建一个新的网络项目。
I have added below code in my App.js but it is not getting integrated with Google Analytics我在 App.js 中添加了以下代码,但它没有与 Google Analytics 集成
useEffect(() => {
ReactGA.initialize('G-*******SYL');
ReactGA.pageview('/');
}, [])
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:我建议您创建一个Universal Analytics Property(如下图所示)并使用相对标识符 UA-XXXXXXX-X 因为 Google Analytics 4 Property ID (G-XXXXXXXX) 目前有 alpha 版本的测量协议,React 也不支持还没完成:
Create a new property, with selected "Create a Universal Analytics property".创建一个新媒体资源,并选择“创建 Universal Analytics 媒体资源”。 It'll show you tracking id.
它会向您显示跟踪 ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.