Firebase 和 Google Analytics - 缺少 measurementId?
Firebase and Google Analytics - missing measurementId?
我有几个使用 Firestore 和 Firebase Storage 的 Firebase 项目。
我想开始使用 Google Analytics,我看到了 this page 和所有说明。关键设置是参数"measurementId"。
因此,按照说明,我转到我的项目设置并找到配置片段,但与说明中不同的是它不包含此参数...
如何生成它?
我也遇到过。网站似乎有错误。设置Firebase CLI和运行以下命令。
firebase --project <project-name> apps:sdkconfig
它应该输出如下内容:
? Select the app to get the configuration data: Web - 1:686396208177:web:5119a766dc890b7d671110 (WEB)
✔ Downloading configuration data of your Firebase WEB app
// Copy and paste this into your JavaScript code to initialize the Firebase SDK.
// You will also need to load the Firebase SDK.
// See https://firebase.google.com/docs/web/setup for more details.
firebase.initializeApp({
// ... snip ...
"measurementId": "redacted"
});
它包括measurementId
。
解决方案来自 Firebase 支持,我的项目需要 "relinked" 到 Google Analytics。
Relink your Firebase project to a Mobile App property
If you had
previously linked your Firebase project with your Analytics account
but are no longer able to locate your Firebase project in Analytics:
Open your Firebase project.
Open Project settings > Integrations.
Click the Analytics card to link Analytics to your project.
更多详情here
我有几个使用 Firestore 和 Firebase Storage 的 Firebase 项目。
我想开始使用 Google Analytics,我看到了 this page 和所有说明。关键设置是参数"measurementId"。 因此,按照说明,我转到我的项目设置并找到配置片段,但与说明中不同的是它不包含此参数...
如何生成它?
我也遇到过。网站似乎有错误。设置Firebase CLI和运行以下命令。
firebase --project <project-name> apps:sdkconfig
它应该输出如下内容:
? Select the app to get the configuration data: Web - 1:686396208177:web:5119a766dc890b7d671110 (WEB)
✔ Downloading configuration data of your Firebase WEB app
// Copy and paste this into your JavaScript code to initialize the Firebase SDK.
// You will also need to load the Firebase SDK.
// See https://firebase.google.com/docs/web/setup for more details.
firebase.initializeApp({
// ... snip ...
"measurementId": "redacted"
});
它包括measurementId
。
解决方案来自 Firebase 支持,我的项目需要 "relinked" 到 Google Analytics。
Relink your Firebase project to a Mobile App property
If you had previously linked your Firebase project with your Analytics account but are no longer able to locate your Firebase project in Analytics:
Open your Firebase project.
Open Project settings > Integrations.
Click the Analytics card to link Analytics to your project.
更多详情here