简体   繁体   English

自定义 Google 跟踪代码管理器 gtm.elementClasses

[英]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.

相关问题 Google跟踪代码管理器(GTM)和Google Analytics变量 - Google Tag Manager (GTM) and Google Analytics variables 将 Google 跟踪代码管理器 (gtm) 安装到 Angular 应用程序 - Install Google Tag Manager (gtm) to Angular app Google代码管理器:是否可以通过GTM将CUSTOM HTML代码放入head标签? - Google tag manager: Is it possible to put CUSTOM HTML code in head tag via GTM? Google标记管理器-是否可以通过GTM标记插入dataLayer? - Google tag manager - is it possible to push into dataLayer via GTM tag? 将vue-gtm(Google标记管理器)附加到路由器实例 - Attaching vue-gtm (google tag manager) to a Router instance 如何使用Google跟踪代码管理器(GTM)跟踪加密的电子邮件链接 - How to track encrypted email links using Google Tag Manager (GTM) 将子字符串提取到 GTM 变量中的简单代码(Google Tag Manager) - Simple code to extract substring into a variable of GTM (Google Tag Manager) (Google跟踪代码管理器)GTM增强型电子商务结帐步骤未跟踪 - (Google Tag Manager) GTM enhanced ecommerce checkout steps not tracking Google跟踪代码管理器gtm.click {{Click Text}} - Google Tag Manager gtm.click {{Click Text}} Google 跟踪代码管理器 (GTM) 错误。 预期的主要表达 - Google Tag Manager (GTM) Error. Primary Expression Expected
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM