SiteLint documentation and guidelines

Google Analytics has no privacy extension enabled

Description

This rule determines if the site uses Google Analytics without the AnonymizeIP Privacy extension. When you anonymize IP in Google Analytics, the last three digits from your website visitor’s IP address are automatically dropped/deleted.

In Google Analytics 4, IP anonymization is not necessary since IP addresses are not logged or stored.

Purpose

This feature is intended to assist site owners in adhering to their own privacy policies, suggestions from regional data protection authorities and regulatory requirements like GDPR, which may forbid the keeping of whole IP address data.

If your privacy policy or local privacy laws prevent the storage of full IP addresses, then you can use the IP anonymization feature to anonymize/mask website visitors’ IPs.

How to fix it

  • Anonymize IP addresses using gtag.js

    If you use the gtag.js library, insert the following line of code in your Google Analytics tracking code to anonymize user IPs.

    {'anonymize_ip': true}

    Final code would then look like:

    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-Y">
    </script>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'UA-XXXXXXXXX-Y', {'anonymize_ip': true});
    </script>

    Note: UA-XXXXXXXXX-Y is a tracking code. Replace it with your own ID.

Standard

Rule ID: google-analytics-geolocation-anonymization

Privacy, Best Practice