Google跟踪代码管理器:事件跟踪不起作用

编程入门 行业动态 更新时间:2024-10-28 14:24:28
本文介绍了Google跟踪代码管理器:事件跟踪不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我尝试使用跟踪代码管理器跟踪我网站上所有mailto链接的点击次数,但根本无法使用。看看使用萤火虫的网络传输,我可以看到没有提交给Google(当然,我的Analytics(分析)界面上也没有任何内容)。 $(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跟踪代码管理器:事件跟踪不起作用

本文发布于:2023-11-27 15:40:32,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:管理器   不起作用   事件   代码   Google

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!