Google跟踪代码管理器:事件跟踪不起作用 [英] Google Tag Manager: Eventtracking not working
问题描述
我尝试使用跟踪代码管理器跟踪我网站上所有mailto链接的点击次数,但根本无法使用。看看使用萤火虫的网络传输,我可以看到没有提交给Google(当然,我的Analytics(分析)界面上也没有任何内容)。点击使用jQuery(正确加载在我的网页上):
$(function(){
$(a bind(click,function(){
dataLayer.push({$ b $'event':'GAevent',
'eventCategory' :'邮件链接',
'eventAction':'点击',
'eventLabel':'我的活动标签'
});
});
} );
然后在Google跟踪代码管理器界面中,我使用适当的网络媒体资源将标记设置为Google Analytics代码ID(如UA-XXXXXX-X)。类型使用以下参数设置为'event':
Category: {{eventCategory}}
操作: {{eventAction}}
标签: {{eventLabel}}
值的字段为空,未设置非交互。
要触发事件,我设置了一个规则 {{eventLabel}}
等于My Event Label。
当然,我也创建了以下宏:
名称:eventLabel
类型:dataLayer变量名称:
变量名称:eventLabel
名称:eventCategory
类型:dataLayer变量
名称变量名称:eventCategory
名称:eventAction
类型:dataLayer变量
变量名称:eventAction
名称:event
类型:用户定义的事件
您是否看到此错误?为什么没有发送给Google?
我知道,即用户定义的变量实际上并不需要,但我没有看到它设置的问题无论如何。
jQuery选择器也很好,当我绑定 console.log
时,我可以在控制台中看到我的消息。
您应该有一个event = GAEvent 。您可以通过创建一个新的宏>自定义事件并将宏名称设置为GAEvent来创建它。
>
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.
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.
这篇关于Google跟踪代码管理器:事件跟踪不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!