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.