Android Google Tag Manager

时光毁灭记忆、已成空白 提交于 2019-12-02 13:31:43

问题


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.

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.

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

W/GoogleTagManager﹕ Resource is a UTF-8 encoded string but doesn't contain a JSON container

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.


回答1:


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

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.

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.



来源:https://stackoverflow.com/questions/28762187/android-google-tag-manager

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!