[英]Google tag manager - is it possible to push into dataLayer via GTM tag?
For the past few days I have been messing with the basics of tag management and "disassembling" the GTM code, trying to figure out how this thing really works. 在过去的几天里,我一直在迷惑标签管理和“反汇编” GTM代码的基础知识,试图弄清这东西是如何工作的。 There is one thing I cannot figure out:
我无法弄清一件事:
Scenario 1. 场景1。
It works like this: 它是这样的:
Scenario 2. 场景2。
Question: 题:
Can this somehow be done via GTM interface? 是否可以通过GTM接口完成此操作? If yes, this means that I can somehow "inject" extra JS code into my page code after the page has loaded in the browser?
如果是,这意味着在页面加载到浏览器后,我可以以某种方式“注入”额外的JS代码到我的页面代码中吗?
Cheers! 干杯!
EDIT (after more education): 编辑(经过更多的教育):
It seems that it is possible to do a lot. 似乎可以做很多事情。 GTM checks if there is a datalayer on the page and if it cannot find one, it creates it for you.
GTM检查页面上是否有数据层,如果找不到,则为您创建一个数据层。 Uou then set up macros to push objects into this DL (events) and finally, you can have tags retrieve information from the DL and send it to the Google analytics.
然后,Uou设置宏以将对象推送到此DL(事件)中,最后,您可以让标签从DL检索信息并将其发送到Google Analytics(分析)。 Am I right?
我对吗?
You could create your own "DataLayer" by creating a dedicated tag declarating an array but this personal DataLayer could not be use in triggers. 您可以通过创建一个声明数组的专用标签来创建自己的“ DataLayer”, 但是此个人DataLayer不能在触发器中使用。
To cover that, you can use another tag with a test (if array contains X then function ...), but I could not see how that is better than your scenario 1. If you do that, be sure to use tag priorities so the first tag is triggerred first. 为了解决这个问题,您可以在测试中使用另一个标签(如果数组包含X,然后是函数...),但是我看不出它比场景1更好。如果这样做,请确保使用标签优先级,这样首先触发第一个标签。
You can use built in Universal Analytics Event tag to track .pdf downloads without dataLayer hard codding. 您可以使用内置的Universal Analytics Event标签来跟踪.pdf下载,而无需进行dataLayer硬编码。
If you want to fire tags after page has loaded you can use "event equals gtm.load" condition in firing trigger. 如果要在页面加载后触发代码,则可以在触发触发器中使用“等于gtm.load的事件”条件。 For example, you can use it to fire customer HTML tag with any kind of Javascript code.
例如,您可以使用它来触发带有任何类型的Javascript代码的客户HTML标签。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.