Google Tag Manager: Eventtracking not working

不问归期 提交于 2020-01-01 18:17:56

问题


I try to track the clicks on all mailto-links on my site using the Tag Manager, but its not working at all. Looking at the network transfer using firebug I can see that nothing is submitted to Google (and of course also nothing appears in my Analytics interface).

I have bind the push to the click using jQuery (correctly loaded on my page):

$(function() {
    $("a[href^='mailto:']").bind("click", function() {
        dataLayer.push({
            'event': 'GAevent',
            'eventCategory': 'Mail Link',
            'eventAction': 'clicked',
            'eventLabel': 'My Event Label'
        });
    });
});

Then in the Google Tag Manager interface I set up a Tag as Google Analytics Tag with proper Web-Property ID (like UA-XXXXXX-X). Type is set to 'event' with the following parameters:

Category: {{eventCategory}}
Action: {{eventAction}}
Label: {{eventLabel}}

The field for value is empty, non-interaction is not set.

To trigger the event I set up a rule {{eventLabel}} equals My Event Label.

Of course I have also created the following Macros:

Name: eventLabel
Type: dataLayer variable
Name of variable: eventLabel

Name: eventCategory
Type: dataLayer variable
Name of variable: eventCategory

Name: eventAction
Type: dataLayer variable
Name of variable: eventAction

Name: event
Type: user defined event

Do you see any errors in this? Why is nothing sent to Google?

I know that i.e. the user defined variable is actually not needed but I don't see a problem in having it set up anyway.
The jQuery selector is also fine, when I bind console.log the the same event I can see it my message in the console.


回答1:


Two things:

You should have an event = GAEvent. You can create this by creating a new macro > Custom Event and setting the macro name to GAEvent.

On your rule, you will need to add your event = GAEvent to your rule.



来源:https://stackoverflow.com/questions/18962821/google-tag-manager-eventtracking-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!