Google Consent Mode - Measure Conversion Data Respecting Consents

Have more questions? Submit a request

Google Consent Mode API is now supported by CMP Cookie First.

Google Consent Mode allows for better conversion and tracking data while still being compliant to the GDPR. Cookie First is among the few CMPs that have implemented this feature. 

Why is this Google Consent Mode important for website owners?

The main reason is this gives you a lot more insight in traffic and conversions while still being compliant to the users consents. You can have GTM, Google analytics or Google Ads working on your website without the use of analytics and marketing cookies. For instance with Ads usually no ads would show on your website because the advertising scripts would simply not fire if someone didn't consent to Advertising cookies. The same goes for analytics. But with this major change by Google you have a lot more insight and data while still respecting the users consent preference! 

The implementation in this article works with the following Google services:

  • Google Ads (Google Ads Conversion Tracking and Remarketing)
  • Floodlight
  • Google Analytics
  • Conversion Linker

More information about this can be found here:

The Consent Mode changes the way Google tags behave according to the consent status of the website visitor. We have made this integration very easy for users of Cookie First. 
Basically there are two commands that are being used with the gtag ('consent') API. 

1. gtag ('consent', 'default') and
2. gtag ('consent', 'update')

These two will control the two new tag settings that can be send. 

Tag Value Default Description
ad_storage 'denied' | 'granted' 'denied' Whether or not to use cookies related to advertising
analytics_storage 'denied' | 'granted' 'denied' Whether or not to use cookies related to analytics


Enable Google Consent Mode in your website

Add the code below to your website before you load Google Tag Manager or gtag.js . The code below has some variables you can change but shouldn't actually as this is the most GDPR friendly way.

window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('consent', 'default', {
'ad_storage': 'denied',
'analytics_storage': 'denied',
'wait_for_update': 1500 //milliseconds
gtag('set', 'ads_data_redaction', true);
IMPORTANT: if you currently work with hard coded google analytics or ads scripts where you edited these by adding data-cookie-first="<category"> as described here: Change website's scripts to comply with the GDPR you should set these analytics scripts to necessary category.


IMPORTANT GTM users: if you currently have integrated Google services like analytics or conversion pixels et cetera over Google Tag Manager and tied them to triggers based on Cookie First events as described here: Google Tag Manager cookie banner configuration Change those Google services to a different trigger like "All pages" (Pageview) and disable any CF triggers


Updating the consent

When a website visitor agrees to accepting performance or marketing cookies Cookie First executes the update command: gtag ('consent', 'update') where ad_storage and respectively analytics_storage are granted.

Redacting Advertising data

If ad_storage is denied Google tags will not set any new cookies for advertising purposes. It also will not read out cookies from and There's the possibility to further redact data when advertising is denied. This is being done automatically by Cookie First as we add the following command. 

gtag('set', 'ads_data_redaction', true);


Articles in this section

Was this article helpful?
6 out of 11 found this helpful