Reputation: 12836
I am trying to get variables that are pushed into the dataLayer to be used as part of Analytics Event Tracking. The values are being added with this :
dataLayer.push({
'location' : 'header',
'linkname' : gaTrackInfo
});
Using console I can see that these variables are being created :
In the Tag Manger UI I set up macros to watch for these variables :
And I am trying to get them into the Event Tracking with something like :
However when I watch in Real Time analytics these vars are always blank :
So from the examples in the screens I would hope to see the category testinglocheader but it just returns testingloc. Any advice on what else I should be looking for to test this. I know it is tracking and getting events sent it is just always missing those values from the dataLayer.
Upvotes: 0
Views: 3110
Reputation: 9603
Try unchecking Set default value on the dataLayer variables. I believe that's overwriting any values you are passing. Also, what does your rule look like?
EDIT:
I found the problem. You need to have an event sent with the onclick.
Steps to fix:
Step 1: Create a new event macro. I typically call mine trackEvent.
Step 2: Add that event to your datalayer.push (the event macro is need in order to pass an event type action into GTM):
dataLayer.push({
'event': 'trackEvent',
'location': 'header',
'linkname': gaTrackInfo
});
Step 3: Remove {{url}} matches RegEx .*
and add {{event}} equals trackEvent
:
Step 4: Publish container.
Upvotes: 2