我有两个Google标签管理器账户,一个是我的账户,另一个是第三方网站的账户,我需要将这两个账户放到这个第三方网站中。
我尝试在body标签开头后放置两个GTM脚本,但我看到了两个账户的重复内容。
该怎么做呢?这种情况是否可行?
我有两个Google标签管理器账户,一个是我的账户,另一个是第三方网站的账户,我需要将这两个账户放到这个第三方网站中。
我尝试在body标签开头后放置两个GTM脚本,但我看到了两个账户的重复内容。
该怎么做呢?这种情况是否可行?
这是因为两个GTM标签都使用了默认的"dataLayer"。请看下面:
<!-- Google Tag Manager -->
<noscript><iframe...
(window,document,'script','dataLayer','GTM-XXXX');</script>
<!-- End Google Tag Manager -->
给定一个或两个自定义数据层名称,像这样...(文档):
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-XXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script’,'gtm1dataLayer','GTM-XXXX');</script>
<!-- End Google Tag Manager -->
之后,您不应该看到任何一个容器中触发重复事件。
dataLayer
变量时,我们发现事件会多次触发。 - Connor Leech更新信息:
根据谷歌官方文档(https://developers.google.com/tag-manager/devguide?hl=en#multiple-containers),建议:
有关详细信息和示例,请参阅此官方网页链接:https://developers.google.com/tag-manager/devguide?hl=en#multiple-containers
Multiple installations of Google Tag Manager detected
We suggest you place only 1 instance of the GTM snippet on a webpage. Multiple GTM snippets don"t work well with each other
Multiple GTM snippets don"t work well with each other because of which the tag added via GTM may not always fire correctly.
Place only 1 instance of the GTM snippet on a webpage
https://support.google.com/tagassistant/answer/3207128?hl=en#multiple_tags
看起来可以为此找到任何您喜欢的答案。根据标签管理器开发人员指南,您可以添加多个容器,但应使用相同的数据层。
https://developers.google.com/tag-manager/devguide#multiple-containers