If you want to use Google Analytics in compliance with data protection regulations, you must do without cookies. To do this, the code for integrating Google Analytics must be adapted.
Disable cookies in Google Analytics
To disable all Cookies, you must set the parameter storage to the value none. This is done by:
ga('create', 'UA-XXXXX-Y', {
'storage': 'none'
});
Only the _gac_<property-id> Cookies can be disabled with the following code:
ga('create', 'UA-XXXXX-Y', {
storeGac: false,
});
Use Web Storage
Instead of traditional cookies, Web Storage can be activated. This is also referred to as Local Storage. Web Storage is also known as Super Cookie. That's quite fitting because more information than with cookies can be stored in the user's device using it. From a data protection perspective, the same applies to Web Storage as to First-Party Cookies. Therefore, consent is required before the tool can be loaded.
Local storage can be activated for Google Analytics with this code:
var GA_LOCAL_STORAGE_KEY = 'ga:clientId';
if (window.localStorage) {
ga('create', 'UA-XXXXX-Y', {
'storage': 'none',
'clientId': localStorage.getItem(GA_LOCAL_STORAGE_KEY)
});
ga(function(tracker) {
localStorage.setItem(GA_LOCAL_STORAGE_KEY, tracker.get('clientId'));
});
}
else {
ga('create', 'UA-XXXXX-Y', 'auto');
}
ga('send', 'pageview');
Consent required?
Without cookies, at least there is a possibility that consent is not necessary. However, with Google products, there is generally the risk of lack of transparency. Accordingly, a violation of Art. 12 GDPR would be given. This could only be mitigated or healed by a consent query.
Depending on the settings chosen for Analytics, consent obligation is at least to be evaluated differently. The French data protection authority has at least declared Google Analytics generally unlawful. The Austrian Data Protection Authority has found that the use of the tool without consent alone is not allowed due to the data transfer to the USA. ([1])
If you want to be on the safe side, choose another tracker. The data quality of Google Analytics without cookies is at least wanting.




My name is Klaus Meffert. I have a doctorate in computer science and have been working professionally and practically with information technology for over 30 years. I also work as an expert in IT & data protection. I achieve my results by looking at technology and law. This seems absolutely essential to me when it comes to digital data protection. My company, IT Logic GmbH, also offers consulting and development of optimized and secure AI solutions.
