google consent mode

Supporting Google Consent Mode

December 3, 2020

User consent in the digital world has become quite a hot topic, thanks to the data privacy laws like the General Data Protection Regulation (GDPR). Suppose you own a website and use cookies for analytical or advertising purposes. In that case, you cannot load the cookies without the users’ consent. 

Cookie consent is one of the most important steps to achieving GDPR compliance for your website.

Not all analytics or advertisements require the personal data of users. However, when users do not give their consent to use the cookies via a consent management system installed on the website, it disables all the cookies. Such a system of blocking all analytics or advertising cookies may dampen the digital economy. There was a lack of a system that maintained the marketing efforts while still respecting users’ consent. That is why Google introduced the Consent Mode.

What is Google Consent Mode? 

Google Consent Mode (GCM) is the new API developed by Google to measure conversions while still respecting user consent. It helps to honor both marketing and privacy efforts at the same time. With the Consent Mode, you can modify the behavior of Google tags based on user consent.

The digital economy suffered inadvertently due to the privacy preferences of users. The new API will help achieve the best of both worlds.

How does Google Consent Mode work?

The Consent Mode introduces two new tag settings:

  • analytics_storage
  • ads_storage

They manage cookies for analytics and advertising purposes, respectively, using the global site tag or Google Tag Manager. You can use these settings for Google services to modify how Google tags should behave based on the user’s consent. 

Google products such as Google Ads, Floodlight, and Google Analytics, support the Consent Mode.


This tag setting is for analytics cookies. It will control the analytics cookies depending on the user’s consent.

The default state of the setting is ‘granted.’ 

When users deny consent, the tag setting will adjust the behavior of analytics cookies accordingly, and you will only receive a functional or aggregate level of information, such as,

  • The timestamp of user visits
  • User agent, i.e., device/platform that loads the website
  • Referrer, i.e., a page from where users came to your website
  • Whether or not the current page or a prior page included ad-click information in the URL
  • Boolean information about the consent state
  • The random number for each page load


This tag setting will control the marketing cookies depending on the user’s consent.

Like, analytics_storage, the default state of the setting is always ‘granted.’

When users deny consent, it will signal the cookies to stop collecting personal data. So, you cannot use targeted advertising. Instead, there will be general advertising which does not require identifying data of users.

All Google tags must load before the user consents. Therefore, please ensure that the Consent Mode loads the tags before the cookie consent banner appears so that Google tags can adjust their behavior depending on the user’s consent preference. 

The Google Consent Mode process flow is as follows:

google consent mode

To modify the tag behavior according to the user consent, use the

gtag('consent', '<consent_command>', {<consent_type_settings>});

When <consent_command> is:

  • default – It applies the default settings.
  • update – It updates the existing consent settings after the user grants consent.

<consent_type_settings> is what the user decides, i.e.,  ‘denied’ or ‘granted’. 

The Consent Mode’s behavior depends upon the consent status of the user. Let us look at some behaviors according to the user consent status. 

#1 The default setting or before the user choose their preference

ad_storage='granted' and analytics_storage='granted'

In this case, both analytical and advertising cookies are in use. You will receive aggregate as well as the individual levels of information. First-party, as well as third-party conversion cookies, are active.

#2 If the user denies consent to use advertising cookies

  • New advertising cookies will not be used.
  • First-party and third-party cookies will not be used except for the aggregate level of advertising.
  • Google Analytics will not collect data for website traffic.
  • Google Analytics will collect IP addresses as part of its usual functioning. However, it will not log the same. It deletes the IP addresses immediately after collection.

#3 If the user denies consent to use analytics cookies

  • First-party analytics cookies will not be used.
  • Google Analytics will send an aggregate level of information.
  • Google Optimize remains unaffected.

Start a 14-day free trial

Trials start with all our features enabled. Cancel anytime. No credit card required.