0
votes

I'm trying to integrate GTM iOS sdk into my app. I've following steps track the page views in the app but still had no luck.

TAG Manager Admin Panel

Step 1: Created a Data Layer Variable called screenName (name: screen name)

Step 2: Create a trigger with Event as Custom and fire on event equal to openScreen (Trigger name = Pageviews)

Step 3: Create the tag with following config data

- Product : google analytics
- Tag type : Universal Analytic
- Tracking ID : <Google analytic account ID>
- Track type : App View
- Fields to set:
    * field name: &cd   /  value : {{screen name}}

Note: According to the documentation the field name should be set as Screen Name but it didnt work for me. I have found this link in this forum which says we should use &cd instead.

iOS Code

TAGDataLayer *dataLayer = [TAGManager instance].dataLayer;

[dataLayer push:@{@"event": @"openScreen", @"screenName": @"login Screen"}];

What am I missing here? I've enabled Verbose error login and I found out my custom variable is not set in the post.

But if I test whether the variable exist in the dataLayer using [dataLayer get:@"screenName"] it returns me the correct value.

1

1 Answers

0
votes

As stated in: Google Tag Manager doesn't fire events to Google Analytics Google Analytics shows stats only after 24 hours: https://support.google.com/analytics/answer/1009683?hl=en. I can confirm that from my own experience. Also confirm that you do not run Google Analytics in dryRun mode: Google tag manager won't push event's to datalayer on Android And make sure that you define your tag as in here: How to configure Android Google Tag Manager v4 with Google Analytics (Universal Analytics) You basically have to define Data Layer variable in Variables tab in your Google Tag Manager web interface. You also have to link your Google Analytics and Google Tag Manager accounts in Admin tab of Google Analytics interface. Hope this helps!