문제

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 :

Example of console showing values pushed into dataLayer

In the Tag Manger UI I set up macros to watch for these variables :

Macros in Tag Manager UI

And I am trying to get them into the Event Tracking with something like :

Calling variables into event tracking

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.

도움이 되었습니까?

해결책

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.

enter image description here

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:

enter image description here

Step 4: Publish container.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top