数据层Google标记管理器 [英] datalayer google tag manager

查看:100
本文介绍了数据层Google标记管理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Google跟踪代码管理器,点击事件进展顺利,但是当我尝试使用数据层时却无法正常工作 这是我的数据层

Iam using google tag manager it's going very well with click events but when I tried to use datalayer it's not working here is my datalayer

   <script>
$('.tag').click(function(event){
    dataLayer.push({
        'event':'myNewTransaction',
        'eventCategory': 'App', //create a datalayer variable macro called eventCategory
        'eventAction': 'Click', //create a datalayer variable macro called eventAction
        'eventLabel': 'iOS' //create a datalayer variable macro called eventLabel
    });
});

然后在控制台中,当我单击具有标签"类的元素时,会收到此消息 标签未在此页面上触发 这是触发触发器时的消息

And in the console when I click on the element with class 'tag' I get this message Tag Not Fired On This Page and this is the message when firing triggers

事件等于myNewTransaction

Event equals myNewTransaction

_event等于我的新交易

_event equals My New Transaction

请帮助

推荐答案

对于单击事件,您应尝试坚持使用默认的单击和链接单击侦听器(gtm.clickgtm.linkClick),然后触发代码根据点击的类甚至点击的文本触发当您可以使用内置的功能时,使用dataLayer效率不高.就是说,如果由于某种原因您仍然需要使用dataLayer,那么

For click events, you should try to stick to using the default click and link click listeners (gtm.click and gtm.linkClick), and then triggering your tag to fire based on the clicked class or even the clicked text. It's not as efficient using the dataLayer when you can use what is already built-in. That said, if for some reason you still need to use the dataLayer, then

  1. 您的代码看起来不错
  2. 您应该创建一个Custom Event触发器,并将事件的值设置为"myNewTransaction"
  3. 您的代码应基于此自定义事件触发器触发
  1. your code looks fine,
  2. you should create a Custom Event trigger with the value of the event as "myNewTransaction"
  3. your tag should fire based on this custom event trigger

如果仍有问题,请发布标签和触发器配置的屏幕截图.

If you still have issues, then please post screenshots of your tag and trigger configurations.

这篇关于数据层Google标记管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆