Page 1 of 1

Google Tag Manager

Posted: 06 Jun 2019, 19:46
by raffi
Hi,

Is there a way to add Google Tag Manager tracking instead of Google Analytics ID ?

GTM looks like this :
Code
  <!-- Google Tag Manager (noscript) -->
  <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXXXX"
    height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <!-- End Google Tag Manager (noscript) -->
The code is supposed to placed highest position in <body>

Re: Google Tag Manager

Posted: 06 Jun 2019, 21:33
by mjau-mjau
X3 already uses Google tag manager when you add your  tracking ID to Settings > Accounts. From the X3 demo:
Image

For your reference, the analytics.js script you see there, is automatically injected by the google tag manager script. Also, when adding tracking from Accounts > Settings, it means X3 will automatically track dynamic pages also (eg. pages that are loaded via Ajax/HTML5). Finally, the official google tags manager integration look like below:
Code
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-123456-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-123456-1');
</script>
The specific code you are referring to in <noscript> is specifically to trigger events in browsers with Javascript DISABLED. Let's face it ... You won't get any visitors with Javascript disabled these days, since most websites rely on it, and even X3 will not work without Javascript. Read more about this:
https://www.analyticsmania.com/post/goo ... -noscript/

Re: Google Tag Manager

Posted: 06 Jun 2019, 21:45
by raffi
My GMT tag looks more like this :  GTM-5FVGANC
I have added this ID in the regular place, and it looks like this working fine !

Thanks mjau-mjau !
you're the man !
:)