Two different google tag manager accounts in same domain

风流意气都作罢 提交于 2019-12-04 17:36:36

问题


I have two google tag manager accounts one mine and another of third party website and I need to put these 2 in this third party website. I tried put two gtm scripts after body tag opening but I saw duplicated content of both accounts.

How can I do this? It's possible?


回答1:


This is because both GTM tags are using the default "dataLayer". See below:

<!-- Google Tag Manager -->
<noscript><iframe...
(window,document,'script','dataLayer','GTM-XXXX');</script>
<!-- End Google Tag Manager -->

Give one or both custom dataLayer names like so...(documentation):

<!-- 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 -->

After that you should see no duplicate events firing from either container.




回答2:


Google tells us that you should not use two tag managers on one site. Google Support:

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




回答3:


There should be no issues with multiple GTM containers on the same page. Unless you have duplicate codes in the containers which are double firing pixels. You can add those containers after the opening body tag.

To check what is firing on the entire page. Download firebug for firefox and add the "omnibug" extension. The omnibug extension should be in the firefox firebug window when you open it.

When you go the omnibug in the firefox panel, you will see EVERYTHING THAT IS FIRING!

If there are duplicate tags firing in the omnibug box, then you can check the details of the event and figure out which specific tag and delete them from the GTM container that you own.




回答4:


Seems possible to find any answer you like for this. According to tag manager developer guide you can add multiple containers but you should use the same datalayer.

https://developers.google.com/tag-manager/devguide#multiple-containers



来源:https://stackoverflow.com/questions/21465360/two-different-google-tag-manager-accounts-in-same-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!