Brantrix Blog
analytics setup

How to set up Google Analytics correctly? – Europe DSGVO compliant

How to create a Google Analytics account.

  • Sign in to Google Analytics.
  • Click Administration.
  • From the menu in the ACCOUNT column, select the account to which you want to add the property.
  • If you have many accounts, you can find that account through the search box.
  • In the menu in the PROPERTY column, select Create New Property.
  • Select website.
  • Enter the website.
  • Enter website URL. (If your URL is not properly formatted, you can not create a property.)
  • Select an industry.
  • Select the time zone for reports.
  • Click Get Tracking ID.

Include Google Analytics tracking code

Log in> Administration> PROPERTY Tracking information> Tracking code

For DSGVO the following things have to be considered.

  • gaOptout () Function – Allows your visitor to permanently disable tracking. This option must be executable in your privacy policy.
  • Further, the option must be ga (’set‘, ‚anonymizeIp‘, true); be set so that the IP addresses of your visitors remain anonymous
var gaProperty = 'UA-XXXXXXX-X';
var disableStr = 'ga-disable-' + gaProperty;
if (document.cookie.indexOf(disableStr + '=true') > -1) {
window[disableStr] = true;
}
function gaOptout() {
document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
window[disableStr] = true;
alert('Das Tracking ist jetzt deaktiviert');
}
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); 

ga('create', 'UA-XXXXXXX-X', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');

! Important ! Do not use this EXAMPLE CODE !

Now you or your webmaster can integrate the enhanced Google Analytics HTML code into the source code of all frontend pages of your website.

If you use a content management system (CMS) such as Typo3, Joomla, Redaxo or WordPress, you must integrate the snippet in the frontend templates. Many of these CMS also have plug-ins (extensions) for Analytics integration on the Web.

The position of the Analytics snippet is important: the tracking code belongs in the header area, ideally directly at the beginning of the <head>. There have been other best practices in the past – e.g. the end or the beginning of the <body> or directly before the closing </head> tag. All this is no longer valid.

 

Brantrix

Add comment

/* ]]> */