Google Consent Mode v2: setup with GTM and dataLayer

The official reference is the Google Consent Mode guide.

What Google Consent Mode v2 is

Google Consent Mode v2 is the framework with which Google tags — GA4, Google Ads and Floodlight — adapt cookie reads and writes to the state chosen on the CMP banner. Since March 2024, in the European Economic Area, it is the step required so you do not lose remarketing, Enhanced Conversions and Smart Bidding quality.

It does not replace the banner. It translates the user’s legal choice to the measurement scripts. Without this bridge, the banner and the tags do not talk to each other: that is the case covered by the Consent Mode v2 product page.

In short. If after the banner Ads conversions collapse and CPA rises, the problem is usually not the campaign. The tags were blocked entirely before consent, instead of starting in Advanced mode with denied parameters. In that state Google can model a share of the conversions of people who refuse cookies, up to about 70% in the cases Google documents for modeling, without treating them as consents.

The four Consent Mode v2 parameters

Compared with the first version, v2 adds two signals about profiling. These are the four values the dataLayer must communicate to Google. Each accepts only denied or granted.

Consent Mode v2 parameters
ParameterScopeEffect
ad_storageAdvertising storageRead and write of ads cookies, for example _gcl_aw, to attribute the click.
analytics_storageAnalytics storageStatistics cookies (_ga, _ga_*) for sessions and duration in GA4.
ad_user_dataUser data sent to GoogleSending of data used in advertising, including click identifiers and hashed Enhanced Conversions data.
ad_personalizationPersonalized adsUse of data for remarketing, audiences and dynamic retargeting. See Dynamic Remarketing.

Basic and Advanced: the prior block

The most common mistake is to stop the Google Tag Manager container, or the individual GA4 and Google Ads tags, with a script until the person clicks “Accept”. That equals Basic mode, or a blind block, and takes away the signal Google models on.

  • Basic. Tags stay off until the click on the banner. If the person refuses or ignores the banner, Google receives nothing: no modeling.
  • Advanced, the one we use. Tags fire immediately, with the four parameters set to denied. They neither read nor write identifying cookies. They send cookieless pings: timestamp, user agent, referring URL, any GCLID or GBRAID and the consent state.

With those pings, behavioral modeling in GA4 and conversion modeling in Google Ads estimate the conversions of people who did not consent, starting from people who accepted, without treating a refusal as a yes.

Order in the dataLayer and in GTM

The default command must run before the Google Tag Manager snippet (gtm.js) or gtag.js. If the CMP already has a template that emits consent on Consent Initialization, do not duplicate it by hand.

1. Default state, consent default

In the , before the container:

wait_for_update holds the first hits for 500 milliseconds, so the CMP can read a consent already saved and you do not get a denied immediately followed by granted.

2. Update, consent update

On the click on “Accept” or on the custom choice, the CMP must update the state. The cookie_consent_update event is for tags that do not understand Consent Mode, for example Meta:

function onUserConsentAccepted(preferences) {
  gtag('consent', 'update', {
    'ad_storage': preferences.marketing ? 'granted' : 'denied',
    'analytics_storage': preferences.statistics ? 'granted' : 'denied',
    'ad_user_data': preferences.marketing ? 'granted' : 'denied',
    'ad_personalization': preferences.marketing ? 'granted' : 'denied'
  });
  window.dataLayer.push({ event: 'cookie_consent_update' });
}

3. Triggers in GTM

  • Google tags (GA4, Ads conversion, remarketing): normal triggers, Initialization, All Pages or the conversion event. They must not be blocked with a consent condition. The tag adapts the request on its own: gcs=G100 if denied, gcs=G111 if granted.
  • Third-party tags (Meta, LinkedIn, Hotjar): they do not read Consent Mode. In GTM you need Additional Consent, for example on ad_storage, and a trigger on cookie_consent_update. The shop’s TAG Facebook and TAG LinkedIn must fire only after that event.

Checks in Preview and Tag Assistant

Do not take the CMP as good, neither Iubenda nor Cookiebot nor OneTrust, just because the plugin is installed. In an incognito window, GTM Preview, Consent tab.

  1. Consent Initialization before Container Loaded. On-page Default must be Denied on the four parameters. If it is Granted before the click, the page does not respect prior consent.
  2. Google tags fire even if the state is denied. On Container Loaded, GA4 and Google Ads are in Tags Fired. In the request to google-analytics.com/g/collect, gcs is G100.
  3. A second Consent event after the click. On-page Update and Current State switch to Granted.

Repeat the audit when you change CMP or theme, or when backend orders (Shopify, WooCommerce, PrestaShop) and Ads conversions diverge by about 25–30%. In that case start from Supporto 5 ore or from the Consent Mode v2 quote.

FAQ about Consent Mode

default and update commands

What is Consent Mode in Google’s Tag Platform?

It is the way Google tags receive the consent state and adapt cookies, identifiers and pings. It does not replace the banner: it reads the choice the banner collected. The implementation package is Consent Mode v2.

Which consent parameters does Consent Mode handle?

  • ad_storage: advertising storage.
  • analytics_storage: analytics storage.
  • ad_user_data: user data for advertising purposes.
  • ad_personalization: ad personalization and remarketing.
  • Where needed: functionality_storage, personalization_storage, security_storage.

What is the difference between default and update?

default is the initial state, before tags fire. In regions that require prior consent it is often denied. update arrives when the person accepts or refuses in the CMP and replaces that state.

Why must default be set before tags fire?

Because a tag that fired before default can write cookies that conflict with the initial choice. Tags on the same event must read a single, consistent state. The order relative to the queue is the one in the DataLayer guide.

Why is Consent Mode not configured with a custom HTML tag?

Custom HTML fires at a moment that is not aligned with the queue and with tag evaluation. You use GTM’s consent APIs or gtag('consent', ...) and the CMP integration.

How does GTM show the same update to every tag?

With the consent APIs and with the checks already present in native tag templates. The update is processed in the correct order relative to queued messages, not “whenever it happens”.

Effects of a refusal, the CMP and checks

What happens if analytics_storage is denied?

Google Analytics 4 tags cannot read or write the analytics cookies used to recognize user and session. Cookieless pings can remain, depending on the Consent Mode configuration.

What happens if ad_storage, ad_user_data or ad_personalization are denied?

Advertising storage, the sending of user data for ads purposes, or personalization, including remarketing, is limited. Google Ads tags stay compliant with the choice. Modeling, where provided, is not the same as ignoring a refusal.

What is a CMP and how does it connect to the Tag Platform?

It is the system that collects and stores the choice. It integrates with GTM or gtag.js by emitting default and update, and possibly TCF v2.2. Without this bridge, the banner and the tags do not talk to each other: that is the problem Consent Mode v2 closes.

What problems happen with IAB TCF implementations?

Strings or purposes that do not match, a CMP that arrives after the tags, TCF support turned on only halfway in the Google tags. Tag Assistant shows the state that was actually read, not the one the plugin promised.

How do you check Consent Mode in Tag Assistant?

In the timeline, for every event, you read Default and Update for each parameter. A tag must not fire with a state different from the rules set for that moment.

What role does Consent Mode play in server-side tagging?

The state also travels to the server container. Tags that fire from the server must respect the same choice, not a second policy.

What does the gcs parameter mean in GA4 requests?

gcs is the compact consent state (G1xy). G100: ad_storage and analytics_storage denied. G111: both granted. G101: ads denied and analytics granted. gcd carries the encoded state of all four v2 parameters.

Why does Consent Mode v2 not fix Meta Ads or TikTok?

gtag('consent') belongs to Google. In GTM the state can block a third-party tag, but Meta asks you not to launch fbq('init') before consent, or to use fbq('consent', 'revoke') aligned with the CMP. TAG Facebook must not sit on All Pages if ads consent is denied.

When should the Consent Mode audit be redone?

On every CMP or theme change, and when CMS orders (Shopify, WooCommerce, PrestaShop) and Google Ads conversions diverge by about 25–30%.

From this guide to the product

If the banner does not talk to the tags, start from a product page. If the site needs hands-on work, start from the hours.

Consent Mode v2
Quote

Consent Mode v2

Cookie banner connected to Google tags.

Supporto 5 ore
Technical hours

Supporto 5 ore

A check of default, update and tags that fire too early.

Dynamic Remarketing
Quote

Dynamic Remarketing

Product events and feed alignment for Google Ads.

Consent Mode v2
Quote

Consent Mode v2

Cookie banner connected to Google tags.

Supporto 10 ore
Technical hours

Supporto 10 ore

Medium-sized projects or several clients of the same agency.