本文介绍了Android 谷歌标签管理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按照营销团队的要求为 Android 应用程序 V4 实施 Google 跟踪代码管理器以备将来使用,而且我从未为网站开发过 GTM,因此我在这种情况下很幼稚.

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.

我已经按照官方网站上的说明创建了帐户和容器以及标签.我已将标签管理器与谷歌分析跟踪 ID 相关联.我已经根据网站上的说明在我的应用程序中编写了代码并将容器下载到原始文件夹.

I have created account and Container and tags according to instructions on official site.I have linked tag manager with google analytics tracking id.I have written code in my application according to instructions on website and downloaded container to raw folder.

当我运行我的应用程序时,它会在 logcat 中给我警告和详细信息

When I run my app it gives me warning and verbose in logcat

W/GoogleTagManager: Resource 是一个 UTF-8 编码的字符串,但不是包含一个 JSON 容器

D/GoogleTagManager:资源不在磁盘上

D/GoogleTagManager﹕ resource not on disk

现在我不确定这里的问题是什么,数据也没有反映在分析中.

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)

按照此链接创建宏和标签.http://online-behavior.com/analytics/mobile-apps-tag-经理

Follow this link to create Macros and Tags.http://online-behavior.com/analytics/mobile-apps-tag-manager

仔细查看您是否为标签创建了触发规则.还要验证您是否已发布容器.尝试在 onCreate() 方法中打开您的容器.

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() 中打开容器后,在 GTM V4 中,首选方式是您需要在 onStart() 方法中像这样推送您的事件.

In GTM V4 after opening container in onCreate(), preferred way is that you need to push your event like this in your onStart() method.

 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.

这篇关于Android 谷歌标签管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 04:07
查看更多