Google Consent Mode without GTM (Manual integration)

Have more questions? Submit a request

Google Consent Mode API is 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. 

!important: this guide is manual integration of consent mode for inline scripts. If you are using Google Tag Manager please refer to this guide. Google Tag Manager and Google Consent Mode


Why is this Google Consent Mode important for website owners?

Consent mode provides a mechanism to modify the behavior of your Google tags based on the consent preferences of your users, allowing Google to account for any missing conversion data. It enables you to specify whether consent has been acquired for the utilization of cookies by Google Analytics and Google Ads. Google's tags will dynamically adjust, using cookies only for the designated purposes when consent has been affirmed by the user. Through the utilization of consent signals, conversion modeling is employed to reclaim any lost conversions stemming from consent alterations.

Consent mode can be utilized in Google Ads for the purposes of conversion tracking and managing your data segments.

Moreover, consent mode can be extended to:

  • Floodlight
  • Google Analytics

Consent mode modeling is accessible in Google Ads for users who fulfill all the necessary eligibility criteria. Modeled conversions will be displayed in the 'Conversions' column and will be incorporated in all subsequent reports utilizing this data. You can check your consent mode status to verify if your consent mode has been accurately deployed and if your modeling is currently active, plus you can analyze the consent mode impact results to gauge the effect of modeling on your conversion quantities.

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 how Google Tags are behaving, whether they track limited data and cookies. Google Consent Mode has 5 Consent Types which can be set. Refer to the table below to see what they mean.

GTM Consent Type

Value Default Description
ad_storage 'denied' | 'granted' 'denied' Enables storage (such as cookies) related to advertising
analytics_storage 'denied' | 'granted' 'denied' performanceEnables storage (such as cookies) related to analytics e.g. visit duration
functionality_storage 'denied' | 'granted' 'denied' Enables storage that supports the functionality of the website or app e.g. language settings
personalization_storage 'denied' | 'granted' 'denied' Enables storage related to personalization e.g. video recommendations
security_storage 'denied' | 'granted' 'granted' Enables storage related to security such as authentication functionality, fraud prevention, and other user protection. *No consent required although users are informed in the cookie policy about these scripts and cookies

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',
'functionality_storage': 'denied',
'personalization_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.


Enable Consent Mode for your banner

Open your Domain settings and go to the tab "Banner settings". Enable the option Google Consent mode and save your configuration.

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 12 found this helpful