Google Analytics: Encrypting IP adresses

How can I encrypt the IP addresses of my clients by Google Analytics
Written by Dennis
Updated 1 year ago

Since the new data protection regulation there is a lot of provisions to follow to ensure legal conformity. This regulation includes the protection of your clients IP adreeses when using apps of externals, e.g. Google Analytics. But don't worry: If you follow the following steps you are safe to go: 

1. Go to your backend to: Appearance → Themes → Your Themes → Edit Source Code (click on the 3 dots)

2. Go to "master.html"

3. Search for "analytics" by using Ctrl+F

4. Delete the following code:

{% if store.google_analytics_id %}<script type=“text/javascript”>
       (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’,‘//www.google-analytics.com/analytics.js’,‘ga’);
       ga(‘create’, ‘{{ store.google_analytics_id }}’, ‘auto’);
       ga(‘send’, ‘pageview’);
     </script>{% endif %}

5. Insert the following code instead:

{% if store.google_analytics_id %}<script type=“text/javascript”>
       (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’,‘//www.google-analytics.com/analytics.js’,‘ga’);
       ga(‘create’, ‘{{ store.google_analytics_id }}’, ‘auto’);
       ga(‘set’, ‘anonymizeIp’, true);
       ga(‘send’, ‘pageview’);
     </script>{% endif %} 

6. Hit the save button before leaving the design menu to make sure all your changes are saved.

Did this answer your question?