Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
raffi
Experienced
Topic Author
Posts: 44
Joined: 15 Nov 2018, 09:34

Google Tag Manager

06 Jun 2019, 19:46

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>
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: Google Tag Manager

06 Jun 2019, 21:33

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/
 
User avatar
raffi
Experienced
Topic Author
Posts: 44
Joined: 15 Nov 2018, 09:34

Re: Google Tag Manager

06 Jun 2019, 21:45

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