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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With