简体   繁体   English

将Google Analytics与FireBase + Google跟踪代码管理器Android SDK配合使用

[英]Using Google Analytics with FireBase + Google Tag Manager Android SDK

How to fire Google Analytics tag using Firebase + Google Tag Manager SDK in Android? 如何在Android中使用Firebase + Google跟踪代码管理器SDK触发Google Analytics代码? I added the Firebase container to my assets/container folder and created a Google Analytics tag using my GA Tracking id. 我将Firebase容器添加到我的资产/容器文件夹,并使用我的GA跟踪ID创建了Google Analytics代码。 I have followed exactly the steps as given in this tutorial: https://developers.google.com/tag-manager/ios/v5/#introduction 我完全按照本教程中给出的步骤操作: https//developers.google.com/tag-manager/ios/v5/#introduction

I trigger the appLaunch event with the below code: 我使用以下代码触发appLaunch事件:
mFirebaseAnalytics.logEvent("appLaunch", null); mFirebaseAnalytics.logEvent(“appLaunch”,null);

How can I see this in my Google Analytics report? 如何在我的Google Analytics报告中看到这一点? Please correct me if am wrong. 如果我错了,请纠正我。 Below are the logs printed when the above code is executed. 以下是执行上述代码时打印的日志。

05-29 04:01:19.947 10378-10419/com.aiswarya.firebase I/FA: Tag Manager is not found and thus will not be used 05-29 04:01:19.947 10378-10419 / com.aiswarya.firebase I / FA:找不到标签管理器,因此不会使用
05-29 04:01:19.947 10378-10419/com.aiswarya.firebase D/FA: Logging event (FE): appLaunch, Bundle[{_o=app}] 05-29 04:01:19.947 10378-10419 / com.aiswarya.firebase D / FA:记录事件(FE):appLaunch,Bundle [{_ o = app}]
05-29 04:01:19.947 10378-10419/com.aiswarya.firebase V/FA: Using measurement service 05-29 04:01:19.947 10378-10419 / com.aiswarya.firebase V / FA:使用测量服务
05-29 04:01:19.947 10378-10419/com.aiswarya.firebase V/FA: Connecting to remote service 05-29 04:01:19.967 10378-10419/com.aiswarya.firebase D/FA: Connected to remote service 05-29 04:01:19.947 10378-10419 / com.aiswarya.firebase V / FA:连接到远程服务05-29 04:01:19.967 10378-10419 / com.aiswarya.firebase D / FA:连接到远程服务
05-29 04:01:19.967 10378-10419/com.aiswarya.firebase V/FA: Processing queued up service tasks: 1 05-29 04:01:19.967 10378-10419 / com.aiswarya.firebase V / FA:处理排队的服务任务:1

Thanks in Advance! 提前致谢!

You should enable debug logging for both FirebaseAnalytics and Google Tag Manager and look at the logcat. 您应该为FirebaseAnalytics和Google跟踪代码管理器启用调试日志记录,并查看logcat。 It will likely answer your question. 它可能会回答你的问题。

You can enable Scion debug logs 您可以启用Scion调试日志

  adb shell setprop log.tag.FA VERBOSE
  adb shell setprop log.tag.FA-SVC VERBOSE
  adb shell setprop log.tag.GoogleTagManager VERBOSE
  adb logcat -v time -s FA FA-SVC GoogleTagManager

View events in Android Studio debug log 在Android Studio调试日志中查看事件

TagManager is a separate library from Firebase Analytics. TagManager是Firebase Analytics的独立库。 In order to use it in your app you need to add dependency on the tag manager form Google play services. 要在您的应用中使用它,您需要添加对标记管理器表单Google Play服务的依赖性。 When Firebase Analytics starts it will check for the presence of TagManager in the app and print message in logcat. 当Firebase Analytics启动时,它将检查应用程序中是否存在TagManager并在logcat中打印消息。 If the message print TagManager not found you don't have the TagManager in your app. 如果未找到消息打印TagManager,则表明您的应用程序中没有TagManager。 When TagManager is available you will see message like "TagManager found, initializing" 当TagManager可用时,您将看到“TagManager found,initializing”之类的消息

Google Tag Manager needs to be added as a separate dependency; Google跟踪代码管理器需要作为单独的依赖项添加; see the documentation for doing so here: 请参阅此处的文档:

Google Tag Manager for Android Android版Google跟踪代码管理器

In short: 简而言之:

  1. Add to your module's gradle file: 添加到模块的gradle文件:

     dependencies { // ... implementation 'com.google.android.gms:play-services-tagmanager:[latest-version]' } 
  2. Download the container file and add it to /assets/containers . 下载容器文件并将其添加到/assets/containers

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

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