Menü schliessen
Created: March 7th 2012
Last updated: May 1st 2020
Categories: Typo3
Author: Marcus Fleuti

Insert Google Analytics code in Typo3 root template using headerData

Donation Section: Background
Monero Badge: QR-Code
Monero Badge: Logo Icon Donate with Monero Badge: Logo Text
82uymVXLkvVbB4c4JpTd1tYm1yj1cKPKR2wqmw3XF8YXKTmY7JrTriP4pVwp2EJYBnCFdXhLq4zfFA6ic7VAWCFX5wfQbCC

Insert Google Analytics code in your pages' header like this:

1. Edit your Typo3 root template

2. Add the following code to it (change your Google Analytics code accordingly)

// add various page metadata
page.headerData.9999 = TEXT
page.headerData.9999.value (
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-???????-?']);
_gaq.push(['_trackPageview']);
(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
)