What is Google Consent Mode?
Google Consent Mode is a feature introduced by Google to help website owners comply with data protection regulations, such as the General Data Protection Regulation (GDPR) in the European Union. It provides a solution for obtaining and managing user consent for various Google services and tags, including Google Analytics and Google Ads.
With Google Consent Mode, website owners can configure their websites to display personalized content and ads to users based on their consent preferences. It allows website owners to adjust the behavior of Google tags based on the user’s consent status. This means that if a user has not provided consent for certain services, those services will not be activated, thereby ensuring compliance with data protection regulations.
One of the key features of Google Consent Mode is the “two-state” solution, which provides two distinct states for tags based on user consent:
- Consent Required: This state is used for tags that require explicit user consent before they can be activated. For example, if a user has not provided consent for personalized ads, the tags associated with personalized ads will remain inactive.
- Non-Consent: This state is used for tags that can be activated without explicit user consent. However, these tags have limitations on the data they can collect and use. For example, if a user has not provided consent for analytics tracking, the tags associated with analytics will still be activated but will collect only limited data.
By implementing Google Consent Mode, website owners can customize their websites’ behavior based on the user’s consent preferences while ensuring compliance with data protection regulations
Cookie Compliance has fully automated integration with Google Consent Mode.
Implementing Google Consent Mode
You can easily implement the Google Consent Mode no matter how you integrated Google Tag Manager.
Step 1: Place the Google Tag Manager Code in the site header, just below Cookie Compliance script:
If you use GTM the code would look like this:
<!-- Google Tag Manager --> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-XXXXXXX');</script> <!-- End Google Tag Manager -->
If you use direct implementation of Google Analytics or gtag.js it would look like this:
<!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-X"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-XXXXXXXX-X'); </script>
Step 2: Enable the Google Consent Mode in the Cookie Compliance dashboard (Configuration -> Consent).