简体   繁体   English

如何从 Firebase 配置中获取 measurementId?

[英]How to get the measurementId from the Firebase config?

To play with Google Analytics for Web based projects on Firebase we need to use either the Firebase reserved URLs or to copy/update the Firebase config object as the documentation states here .要在 Firebase 上使用基于 Web 的项目的Google Analytics ,我们需要使用 Firebase 保留的 URL 或复制/更新 Firebase 配置object ,如此处文档所述。

I am using the following command to print that config information though: firebase setup:web .不过,我正在使用以下命令打印该配置信息: firebase setup:web

The problem is that it is not printing the measurementId field.问题是它没有打印measurementId字段。

What should I do now?我现在应该怎么做?

In fact the firebase setup:web is not printing the measurementId .事实上, firebase setup:web不打印measurementId But if you refer to Firebase CLI reference you can see that this command is deprecated:但是如果您参考Firebase CLI 参考,您会发现此命令已被弃用:

Deprecated.已弃用。 Instead, use apps:sdkconfig and specify web as the platform argument.相反,使用 apps:sdkconfig 并指定 web 作为平台参数。

You should now use the firebase apps:sdkconfig .您现在应该使用firebase apps:sdkconfig From that command you'll have the measurementId .从该命令中,您将获得measurementId

You need to enable Google Analytics first in the integration tab then you can follow Jijo John's answer.您需要先在集成选项卡中启用 Google Analytics ,然后您可以按照 Jijo John 的回答进行操作。

Firebase 测量 ID

In case anyone trying to find it from the Firebase web console如果有人试图从 Firebase 网络控制台中找到它

  • it is displayed when you enable Google analytics first time for the project.当您第一次为项目启用 Google 分析时会显示它。
  • For seeing the existing firebase configuration用于查看现有的 Firebase 配置

Firebase Console -> Project Settings -> General -> Select your Web App -> Select 'Config' Firebase 控制台 -> 项目设置 -> 常规 -> 选择您的 Web 应用程序 -> 选择“配置”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM