Note this page does not provide a legally verified solution – you should read the law and decide for yourself if these approaches are suitable before implementing yourself.
The legislation
Directive 2009/136/EC, which has come to be known as the Cookie Law
Cookies that do not require consent under
- Cookies that are “strictly necessary” to fulfill the services requested by your site visitors.
Making Google Analytics Compliant
Google analytics does have options which can change how it operates.
ga('create', 'UA-XXXXX-Y', {
'storage': 'none',
'anonymizeIp': true
});
or
ga('create', 'UA-XXXXXXXX-X', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
‘storage’: ‘none’
Google Analytics will not be able to use client-ID (there are no cookies) so no user could be tracked. Effects of this – you will not be able to know:
- Returning visitors. All visits will be considered as a new user.
- Correct attribution in multichannel conversion.
‘anonymizeIp’: true
the last octet of the IP address is changed to zero (12.123.45.789 becomes 12.123.45.0). This feature is called IP Masking in Google terminology.
Google Analytics uses the IP address to determine the location of where your visitors are visiting your website. Stripping the last octet of the IP address will result in a less accurate location, which may mean the region/city in a country might be wrong, but it will still allow trackign by country.