[英]Custom Google Tag Manager gtm.elementClasses
I have been requested by a client to push data into gtm.elementClasses using the dataLayer.push() function.客户要求我使用 dataLayer.push() function 将数据推送到 gtm.elementClasses。 More specifically, 99% of all links on our webpage don't have classes, as they are inside of div elements with button classes and therefore elementClasses is empty.更具体地说,我们网页上 99% 的链接都没有类,因为它们位于带有按钮类的 div 元素内,因此 elementClasses 是空的。
I have found few articles talking about the stuff I think I need, but I seem to have hit a hard wall.我发现很少有文章谈论我认为我需要的东西,但我似乎遇到了困难。
I would say that I could possibly use this for my needs, but the question I have is, how would I do so.我会说我可能会使用它来满足我的需要,但我的问题是,我该怎么做。 Should it trigger on <a>
tag click and then fill the dataLayer with appropriate data?它是否应该在<a>
标记单击时触发,然后用适当的数据填充 dataLayer? If it is the case, how?如果是这样,怎么办?
Until now we used just the easiest setup described here .到目前为止,我们只使用了这里描述的最简单的设置。
Thanks a lot for any kind of answer.非常感谢您的任何回答。
The answer was quite simple - make a specific trigger in GTM and filter it there, not create custom JS functions.答案很简单——在 GTM 中创建一个特定的触发器并在那里过滤它,而不是创建自定义 JS 函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.