简体   繁体   English

同时使用Google Analytics和Google Firebase

[英]Using Google analytics and Google firebase at the same time

I have recently implemented Firebase Analytics to an Android application. 我最近将Firebase Analytics实施到了Android应用程序。 Before that I was using Google Analytics and everything was working correctly. 在此之前,我使用的是Google Analytics(分析),并且一切正常。 Since I implemented Firebase Analytics, I am not receiving any data in Google Analytics - I only get data in Firebase Analytics. 由于我实施了Firebase Analytics,因此我没有在Google Analytics(分析)中收到任何数据-我仅在Firebase Analytics中获得数据。 I have left the code for GA and added also calls for FA but only FA works. 我已经为GA保留了代码,还添加了对FA的调用,但只有FA可以工作。 Does anyone know what the problem is? 有人知道问题出在哪里吗?

I have read that you can do this with Google Tag manager but it looks like a lot of work and is something I would not like to do at the moment. 我已经读到您可以使用Google跟踪代码管理器来完成此操作,但是这看起来需要大量工作,而且我目前不愿意这样做。 Can I send data to both Firebase and Google Analytics without using the tag manager? 是否可以在不使用代码管理器的情况下将数据发送到Firebase和Google Analytics(分析)?

Note that I am using the Json file from Firebase and passing the UA-* property for GA in the initialization of the tracker object. 请注意,我正在使用Firebase中的Json文件,并在跟踪器对象的初始化中为GA传递UA- *属性。

if you want to use both FA and GA analytics together, there are 3 simple actions to do: 如果您想同时使用FA和GA分析,则可以执行以下3个简单的操作:

  1. delete your global_tracker.xml (or analytics.xml, whatever xml where you did store your tracking code UA-xxxxxx); 删除您的global_tracker.xml (或analytics.xml,无论您存储了跟踪代码UA-xxxxxx的任何XML);
  2. in your GoogleAnalyticsApplication.class add private string with your tracking code: private static final String PROPERTY_ID = "UA-xxxxxx-x"; 在您的GoogleAnalyticsApplication.class中添加带有跟踪代码的私有字符串: private static final String PROPERTY_ID = "UA-xxxxxx-x"; and pass this string as parameter to mTracker object creation like this: mTracker = analytics.newTracker(PROPERTY_ID); 并将此字符串作为参数传递给mTracker对象创建,如下所示: mTracker = analytics.newTracker(PROPERTY_ID); .
  3. update analytics_service parameter in your google-services.json this way: 通过以下方式更新google-services.json analytics_service参数:

    "analytics_service": { "status": 1 }, “ analytics_service”:{“ status”:1},

that's all. 就这样。 after this you will have both GA and FA analytics work together correctly. 此后,您将可以同时进行GA和FA分析。

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

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