简体   繁体   English

Android Google跟踪代码管理器

[英]Android Google Tag Manager

I am implementing Google Tag Manager for Android Application V4 as requested by my Marketing team for future use,and I have never worked on GTM for websites so I am naive in this context. 我正在按照市场营销团队的要求为Android Application V4部署Google跟踪代码管理器,以备将来使用,但我从未在网站的GTM上工作过,因此在这种情况下我很幼稚。

I have created account and Container and tags according to instructions on official site. 我已经根据官方网站上的说明创建了帐户,容器和标签。 I have linked tag manager with google analytics tracking id. 我已将标签管理器与Google Analytics(分析)跟踪ID关联。 I have written code in my application according to instructions on website and downloaded container to raw folder. 我已经按照网站上的说明在应用程序中编写了代码,并将容器下载到原始文件夹中。

When I run my app it gives me warning and verbose in logcat 当我运行我的应用程序时,它会在logcat中给我警告和详细信息

W/GoogleTagManager﹕ Resource is a UTF-8 encoded string but doesn't contain a JSON container W / GoogleTagManager:资源是UTF-8编码的字符串,但不包含JSON容器

D/GoogleTagManager﹕ resource not on disk D / GoogleTagManager:资源不在磁盘上

Now I am not sure what is the problem here,and data is not reflected in analytics as well. 现在我不确定这里是什么问题,数据也不会反映在分析中。

在此处输入图片说明 If you are following those steps carefully then this warning doesn't stop you from opening container or sending data to analytics. 如果您认真执行这些步骤,则此警告不会阻止您打开容器或将数据发送到分析。 I am also following instructions available here . 我也在按照此处提供的说明进行操作。 I'm getting these logs 我正在获取这些日志

  W/GoogleTagManager(3101): Failed to extract the container from the resource file. Resource is a UTF-8 encoded string but doesn't contain a JSON container
  V/GoogleTagManager(3101): The container was successfully loaded from the resource (using binary file)

Follow this link to create Macros and Tags. 单击此链接创建宏和标签。 http://online-behavior.com/analytics/mobile-apps-tag-manager http://online-behavior.com/analytics/mobile-apps-tag-manager

Look carefully if you have created firing rules for you tags. 请仔细查看您是否为代码创建了触发规则。 Also verify if you have published your Container. 还要验证您是否已发布容器。 Try opening your container in onCreate() method. 尝试使用onCreate()方法打开容器。

In GTM V4 after opening container in onCreate(), preferred way is that you need to push your event like this in your onStart() method. 在onCreate()中打开容器后,在GTM V4中,首选方式是您需要在onStart()方法中推送此类事件。

 DataLayer mDataLayer = TagManager.getInstance(this).getDataLayer();
 mDataLayer.pushEvent("your event name here", DataLayer.mapOf("screenName",SCREEN_NAME));

Update: I have attached image to show how I'm changing Basic Configuration. 更新:我已附上图片以显示我如何更改基本配置。 Hope this helps. 希望这可以帮助。

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

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