Articles on: Scripts & cookies

Google Consent Mode



If you use any Google products on your website (Google Analytics, Google Advertising Products, etc.), enabling Google Consent Mode is an essential step to comply with data privacy regulations while still delivering personalized ads and user experiences. This feature allows websites and applications to adjust their tracking and advertising practices based on a user's cookie consent preferences set in the Clym widget, reducing the risk of unwanted data collection and privacy violations. By default, if you have blockingJS on your website already, then Google Consent Mode will be rolled out automatically. However, if you do not have this already on your website, you will need to follow the steps below to manually enable Google Consent Mode.


Once enabled, Google Consent mode interacts with the Clym widget to receive your website visitors' consent preferences and ensures that these preferences are preserved across the website pages they visit.


How does it work?


When a page loads before consent has been given, Clym sends a negative consent signal to Google by default for website visitors in the EU/UK.❌


If consent is given, Clym sends a positive consent signal to Google.✅


Enabling Google Consent Mode is an easy 3-step process:




First, copy the script below and inject this before Google Tag Manager on your website.


window.dataLayer = window.dataLayer || [];

  if (!window.gtag) function gtag() { dataLayer.push(arguments); }

  gtag('consent', 'default', {

    'ad_user_data': 'denied',

    'ad_personalization': 'denied',

    'ad_storage': 'denied',

    'analytics_storage': 'denied',

    'wait_for_update': 500,

  });


2. Access services in the Clym Portal


Please sign into your Clym Portal account. From the left side menu, select Website Settings. From here, you will see a list of all your domains, each with its unique settings.


Website Settings tab


Click the settings wheel next to the domain that you would like to change the default language for. This will open the website settings for that specific domain.


Settings wheel icon


From the Website settings menu, select the Services drop-down arrow to view the scripts. In the bottom right corner, click Add Services.


Add services button



You will need to repeat step 3 to create two individual services for Google Consent Mode Advertising and Google Consent Mode Analytics. In the pop-up window that appears, please fill out all of the required fields marked with an asterisk.


Required fields


Under the Script tab, add each value below into the Javascript code field for the service you are creating.


Name: Google Consent Mode Advertising


gtag('consent', 'update', {

      ad_user_data: 'granted',

      ad_personalization: 'granted',

      ad_storage: 'granted',

    });


Name: Google Consent Mode Analytics


gtag('consent', 'update', {

      analytics_storage: 'granted'

    });


Script code field


If Clym has set up Google Consent Mode automatically, the two new services created for Google Consent Mode Advertising and Google Consent Mode Analytics will send positive signals to Google. You can also view your actual values using Google Tag Manager's preview functionality. Please review this knowledge base article to check if Google Consent Mode has been enabled properly.


FAQ


What is the difference between Basic and Advanced implementation?


  • Basic implementation is when the Google scripts are blocked when the consent is denied. This way, Google will receive no data at all as the scripts won’t be executed on the website until consent is granted. This way, Google’s algorithms can not create an uplift based on an estimation. If you want to use Basic implementation, you need to make sure the Google tags are blocked before consent is granted. You can achieve this multiple ways, using our Clym Blocking Solution, Clym Tag Manager or Clym Google Tag Manager integration.
  • Advanced implementation is when the Google tags can execute, or fire, but by default, the consent state is set to a default (denied or granted based on user location and GEO rules). In advanced implementation, Google sends cookieless pings until consent is granted. This way, the uplift can be achieved. To implement the Advanced mode, the Google tags should not be blocked even if consent is denied. To have this, you can disable all the Google Consent Mode supported tags in Clym Portal.


How do I turn off the Google Consent Mode default signal completely?


If you have blocking.js implemented on your website, we will send the Google Consent Mode signals all the time. If you wish to remove this functionality, you can assign an attribute to the blocking.js script in your website. Adding “data-google-consent-mode=false” to the script will prevent signals from being sent.


How can I change which regions Google Consent Mode is implemented for?


By default, we don’t specify the region for the default signal, meaning it will send a denied signal, but if the user is coming from a region where consent is required or the user has expressed consent earlier, we will update it to be accepted before Google tags fire.


However, if you wish to change the default signal, you can do so by adding data attributes to the blocking.js:


  • data-google-consent-mode-default-denied-region=””
  • You can set the regions separated by comma, and Clym will send the denied signal based on the values.
  • Example: “data-google-consent-mode-default-denied-region=”MX,US-CA”


  • data-google-consent-mode-default-granted-region=””
  • Without specifying it, Clym does not send a granted default signal, but if you wish to use it, you can do so.
  • data-google-consent-mode-default-granted-region=”MX,US-CA”


Debugger mode


If you want to verify if Google Consent Mode and/or TCF has been implemented correctly, you can do so by adding this to the URL of your website in your browser: “?clym-debugger” for example: https://clym.io/?clym-debugger or https://clym.io/?someparameter=&clym_debugger


If it’s enabled in the Console of the Developer tools, you will see messages from the Clym Debugger. If the Google Consent Mode default consent signals were fired correctly, you can read this: “Clym Debugger: Google Consent Mode default fires before any Google tags.


If you see this: “Clym Debugger: Some Google tags might have fired before the default consent was set!” then some Google tags fire before the default consent signal was fired. To fix this, you must place the Clym script above the Google Tag Manager script on your website.


If you also use TCF and Clym executes too late, then you will see the message: “Clym Debugger: Google tag was fired before TCF could have been loaded!


To solve this problem, please ensure the Clym scripts are executed earlier by moving them to the top of the website.


If you encounter any challenges, please reach out to us at support@clym.io.

Updated on: 25/04/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!