3
votes

I'm trying to use Google Tag Manager to report screenviews and events to Google Analytics. I followed the google's tutorial but I'm not able to even report the screenviews. Also spent hours searching in google but there was no match. Almost all the information available is for Android's v3 or the old GTM web interface.

This is my configuration

GTM Tag configuration

Google Analytics realtime view

Pushing the event to the data layer throws no error. However screenName seems not been sent.

Java code

public static void pushScreenViewEvent(@NonNull Context context, @NonNull String screenName) {
    DataLayer dataLayer = TagManager.getInstance(context).getDataLayer();
    dataLayer.pushEvent("screenView",
            DataLayer.mapOf("screenName", screenName));
}

Debug log after push data

02-23 19:12:39.376  31787-31888/com.example.debug V/GoogleTagManager﹕ Sending hit to service   PATH: https:  PARAMS: sr=1080x1776,  a=558676027,  v=1,  ht=1424686354314,  an=Example app,  ul=ja-jp,  t=appview,  _u=.L,  tid=UA-XXXXXX-1,  cid=XXXXXX,  aid=com.example.debug,  av=1.0.0,

Google Play Services version

compile 'com.google.android.gms:play-services-base:6.5.87'

There's this tutorial but it is for the old GTM v3 with the old GTM web screenshots https://developers.google.com/tag-manager/android/v3/ua#screenviews

2

2 Answers

2
votes

Ok, it was my fault. There was two problems.

  1. Fields to set were wrong In order to track the screen in GA it's necessary to set the Screen Name's Measurement protocol parameter &cd
    In my case Client Id and User Id are also necessary, that's why I send &ci and &uid Published and working container

  2. I was using a default binary container from a different test account. After use the correct container it worked like a charm.

0
votes

It seems like firing rule is incorrect. Try something like {{event}} equals screenView or Always as firing rule. And it will take 24hrs to update in the Google Analytics dashboard, so it will not appear in the real time. Let me know if it doesn't work.