简体   繁体   English

是否可以在Android中将Firebase Messaging与Google Analytics结合使用?

[英]Is it possible to use Firebase Messaging with Google Analytics in Android?

I started using Firebase Cloud Messaging for an Android app and now I'm trying to add Google Analytics (not Firebase analytics) to the same app. 我开始在Android应用中使用Firebase云消息传递,现在我正在尝试将Google Analytics(而不是Firebase分析)添加到同一个应用中。

The problem is that when creating google-services.json for Analytics, it ignores FCM. 问题是,在为Google Analytics创建google-services.json时,它会忽略FCM。 I'm using the same google account to create both json files. 我正在使用相同的Google帐户创建两个json文件。

I read that when enabling the second service (in this case Analytics) the json should update adding both Messaging and Analytics but maybe this only works within Firebase services? 我读到当启用第二个服务(在本例中为Analytics)时,json应该更新添加Messaging和Analytics,但这可能仅适用于Firebase服务?

I could use Firebase Analytics and actually that's what Google recommends, but is it possible to use both Google Analytics with Firebase services? 我可以使用Firebase Analytics,这实际上就是谷歌推荐的,但是可以同时使用Google Analytics和Firebase服务吗?

Yes, it is possible to use Firebase Cloud Messaging and Google Analytics in the same app. 是的,可以在同一个应用中使用Firebase云消息传递和Google Analytics。 I would suggest using the json file generated by Firebase and merging in the following object into the "services" object : 我建议使用Firebase生成的json文件,并将以下对象合并到“services”对象中:

 "analytics_service": {
          "status": 2,
          "analytics_property": {
            "tracking_id": "<your tracking id>"
          }
        },

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

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