[TYPO3-english] Re: Google Analytics - insert javascript with page.headerData

Dennis Hoffland d.o.hoffland at tele2.nl
Sun Nov 12 13:45:54 CET 2017


Hello Christian,

If I use the standard textbook code as you suggested and replace

<script>
// YOUR JS CODE
</script>

with

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxx-x"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
ga('set', 'anonymizeIp', true); // Toelichting AP: Hiermee zet u de IP-maskering aan
  gtag('config', 'UA-xxxxxxx-x');
</script>

I get the same outcome as described in my first post:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxx-x"></script>

shows up in my HTML page header, and

<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
ga('set', 'anonymizeIp', true); // Toelichting AP: Hiermee zet u de IP-maskering aan
  gtag('config', 'UA-xxxxxxx-x');
</script>

is somehow ignored.

My conclusion: my TS is in principle OK, however the (syntax? of the) second section of the javascript causes some processing issue.

Any thoughts?

Kind regards,

Dennis




More information about the TYPO3-english mailing list