Skip to content

Cookie consent

How to implement Google Consent Mode v2

By the Kiescy teamUpdated 8 min readChecked against the official text on

Google Consent Mode v2 tells Google Analytics, Google Ads and other Google tags whether each visitor agreed to cookies. If you advertise with Google and get visitors from Europe, the UK or Switzerland, Google expects these signals; without them, remarketing and parts of conversion measurement stop working for those visitors.

There are three ways to set it up: let your consent banner do it, use a template in Google Tag Manager, or write the code yourself. This guide walks through each one, shows the order everything has to load in, and lists the mistakes that quietly break it.

The short version

To implement Consent Mode v2, set a default consent state (usually all four signals denied) before any Google tag loads, show a consent banner, and send an update with the visitor's choice. The four signals are ad_storage, analytics_storage, ad_user_data and ad_personalization. The easiest route is a consent banner that supports Consent Mode v2; in Google Tag Manager, add your banner's template on the Consent Initialization – All Pages trigger; with gtag.js, add the default code at the top of <head>.

Words you'll see in this guide (5)
Consent default:
The consent state Google tags assume before the visitor chooses. Set with gtag('consent', 'default', {...}).
Consent update:
The message that tells Google tags what the visitor chose. Sent with gtag('consent', 'update', {...}) or by your banner.
CMP:
Consent management platform: the tool that shows your cookie banner and stores choices.
Community Template Gallery:
Google Tag Manager's library of tag templates made by other companies, including most consent banners.
Basic vs advanced:
Basic blocks Google tags until consent; advanced loads them with cookies off and sends cookieless pings. See our comparison guide.
On this page
  1. The order that matters
  2. With a consent banner
  3. With Google Tag Manager
  4. With gtag.js code
  5. Advanced extras
  6. Common mistakes
  7. Test it
  8. Questions
  9. Sources

The one rule: the default comes first

Whichever route you pick, Consent Mode works the same way underneath. Google's documentation is blunt about it: the order of the code is vital, and if it runs out of order, the defaults won't work.

Diagram of the load order: first the consent default with everything denied, then the Google tag or Tag Manager, then the consent banner. The visitor chooses: Accept sends an update to granted and tags use cookies; Reject stays denied, so in basic mode tags don't load and in advanced mode only cookieless pings are sent.IN <HEAD>, IN THIS ORDER1. Consent default: all deniedgtag('consent', 'default', {...})2. Google tag or Tag Manager loads3. Your consent banner showsVisitor choosesAcceptupdate: grantedRejectstays deniedTags use cookies andsend full dataBasic: tags don’t loadAdvanced: cookieless pings
Default first, then Google's tags, then the banner, then the update. Most broken setups get step 1 out of order.
SignalWhat it controlsAdded in
ad_storageCookies for advertisingv1
analytics_storageCookies for analytics, such as Google Analytics' visitor IDv1
ad_user_dataWhether user data can be sent to Google for advertisingv2
ad_personalizationWhether data can be used for personalised ads (remarketing)v2

If you set up Consent Mode before 2024, you probably only send the first two. Google's documentation asks existing users to add the two v2 signals; the routes below all include them.

Before you start, decide between basic and advanced mode. Basic is the cautious default in Europe; advanced recovers more data. Our basic vs advanced comparison explains the trade-off.

Way 2: Google Tag Manager with a consent template

If your Google tags already run through Google Tag Manager, set Consent Mode up there. Most consent tools publish a template in GTM's Community Template Gallery, and Google recommends that route for Tag Manager sites:

  1. In your GTM container, go to Tags → New and name the tag (for example, "Consent banner").
  2. Click Tag Configuration, then Discover more tag types in the Community Template Gallery, and search for your consent tool's template. Click Add to workspace.
  3. Fill in the template's settings: your banner's ID or code, and the default for each consent type. Use denied for anything that needs consent in your visitors' region.
  4. Under Triggering, choose Consent Initialization – All Pages. This trigger fires before all others, which is what makes the default arrive first.
  5. Click Preview and test on your site (Tag Assistant shows the consent state on each event), then Submit to publish.

Tip: Google tags in GTM, such as the Google tag and Google Ads conversion tags, have built-in consent checks, so you don't need to add triggers for them. Third-party tags like the Meta Pixel or Hotjar don't: give them a trigger that waits for your banner's consent event.

If no template exists for your banner, Google documents how to build one with Tag Manager's consent APIs (setDefaultConsentState and updateConsentState). For most sites, switching to a banner with a template is quicker.

In basic mode, don't load your consent banner through the same GTM container you're blocking until consent. Google's guide for basic mode says to load the banner separately and load Tag Manager only once the visitor accepts.

Since 15 June 2026, Consent Mode's ad_storage is the single control for Google Ads cookies and identifiers sent from the Google tag, including when GA4 and Google Ads share a tag. The Google Signals setting now only decides whether behavioural data is linked in reports. So your banner's advertising choice must reach ad_storage correctly.

Way 3: Add the code yourself with gtag.js

If you built your own banner, add Consent Mode in three parts. This is for developers; if that's not you, use Way 1.

Step 1: Set the default, first in <head>

Put this before the Google tag (gtag.js) or the GTM snippet, on every page:

Default: before any Google tag
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('consent', 'default', {
    ad_storage: 'denied',
    analytics_storage: 'denied',
    ad_user_data: 'denied',
    ad_personalization: 'denied',
    wait_for_update: 500
  });
</script>
<!-- then your Google tag or Tag Manager snippet -->

wait_for_update gives your banner up to 500 milliseconds to apply a choice the visitor made on an earlier visit before tags send anything.

Step 2: Send an update when the visitor chooses

Update: on Accept, Reject or Save
function saveChoice(analytics, ads) {
  const state = {
    analytics_storage: analytics ? 'granted' : 'denied',
    ad_storage: ads ? 'granted' : 'denied',
    ad_user_data: ads ? 'granted' : 'denied',
    ad_personalization: ads ? 'granted' : 'denied'
  };
  gtag('consent', 'update', state);
  localStorage.setItem('consent', JSON.stringify(state));
}

// Accept all:  saveChoice(true, true)
// Reject all:  saveChoice(false, false)

Step 3: Re-apply the stored choice on every page

Consent Mode doesn't remember anything between pages. Read the saved choice early on each page load and send it as an update, so returning visitors aren't asked again and their choice is respected:

Right after the default
const saved = localStorage.getItem('consent');
if (saved) gtag('consent', 'update', JSON.parse(saved));

Optional: different defaults by region

Google lets you scope a default to countries or states with ISO 3166-2 codes; the most specific region wins. A common pattern is denied for Europe and granted elsewhere, but check what the law expects where your visitors are. California, for example, works on opt-out rules, and India's DPDP Act on opt-in consent.

Region-specific defaults (list every EEA country in practice)
gtag('consent', 'default', {
  ad_storage: 'denied', analytics_storage: 'denied',
  ad_user_data: 'denied', ad_personalization: 'denied',
  region: ['AT','BE','DE','ES','FR','IE','IT','NL','SE','GB','CH']  // shortened list
});
gtag('consent', 'default', {
  ad_storage: 'granted', analytics_storage: 'granted',
  ad_user_data: 'granted', ad_personalization: 'granted'
});  // everyone else

Advanced mode extras: URL passthrough and ad data redaction

In advanced mode, two optional settings change what happens while ad_storage is denied:

  • URL passthrough (gtag('set', 'url_passthrough', true)) carries ad click information, such as the gclid, across your pages in the URL instead of a cookie, so conversions can still be linked to clicks. Make sure these extra URL parameters don't break your site or clutter your analytics.
  • Ad data redaction (gtag('set', 'ads_data_redaction', true)) removes ad click identifiers from what Google tags send while ad consent is denied.

Both are optional. If you chose basic mode, skip them: tags aren't loading before consent anyway.

Common mistakes that break Consent Mode

MistakeWhat happensFix
Default loads after the Google tagTags fire before they know the consent stateMove the default to the very top of <head>, or use Consent Initialization in GTM
Only v1 signals sentGoogle treats ad_user_data and ad_personalization as missingAdd both v2 signals to the default and the update
Update sent on the next page, not the one where the visitor clickedGoogle can lose data from that first page, such as session startsSend the update immediately on click, on the same page
Update sent as the page unloadsThe browser can cancel the request before it completesUpdate on click, before any redirect or reload
Choice not re-applied on later pagesVisitors who accepted look denied on every new pageRead the stored choice and send an update on each page load
Two consent tools installedConflicting defaults and updatesRemove one; let a single tool own Consent Mode
Non-Google tags ignore the bannerThe Meta Pixel or Hotjar still fires before consentBlock them until your banner's consent event

Consent Mode only governs Google's tags. Other trackers need to wait for consent separately, which a good banner handles for you. Our guide to what a cookie banner does behind the scenes shows how.

How to check it's working

  1. Open your site in a private window, so no earlier choice is stored.
  2. Before clicking anything, open DevTools → Network and filter for collect. Requests should show gcs=G100 (everything denied) in advanced mode, or no Google requests at all in basic mode.
  3. Click Accept all and reload: requests should now show gcs=G111.
  4. Repeat with Reject all: nothing should switch to granted.
  5. In Google Tag Manager, use Preview; Tag Assistant shows the consent state for every event.

Our step-by-step guide to checking Consent Mode v2 explains what each gcs and gcd value means, and the free website check tests the before-and-after for you.

Questions

Do I need a cookie banner to use Consent Mode v2?

Yes. Consent Mode only passes on a choice; something has to ask the visitor. Google's EU user consent policy also requires you to get valid consent from visitors in the EEA, the UK and Switzerland.

Is Consent Mode v2 required outside Europe?

Google's requirement is about visitors in the EEA, the UK and Switzerland. Elsewhere it's optional, but setting region-specific defaults lets one setup handle every visitor correctly.

Can I implement Consent Mode v2 without Google Tag Manager?

Yes. Use a consent banner that supports it, or add the gtag.js default and update code yourself. Tag Manager is just one of three routes.

Does Consent Mode v2 block the Meta Pixel and other non-Google tags?

No. It only changes how Google's own tags behave. Other tags need to be blocked until consent by your banner or by GTM triggers.

Which consent types do I set to denied by default?

For visitors in Europe, all four: ad_storage, analytics_storage, ad_user_data and ad_personalization. Change them to granted only when the visitor agrees.

What is wait_for_update?

A setting on the default that tells Google tags to wait a short time (in milliseconds) for an update, so a returning visitor's stored choice applies before tags send anything.

Sources

The facts in this guide come from these official sources, last checked on . We review the guide whenever they change.

  1. Google Analytics Help: changes to Google Ads data controls in Google Analytics (15 June 2026)
  2. Google Tag Platform: Set up consent mode on websites (basic and advanced)
  3. Google Tag Manager Help: Set up and manage consent (Community Template Gallery, Consent Initialization trigger)
  4. Google Ads Help: About consent mode
  5. Google: EU user consent policy

Check your Consent Mode setup

See whether your site sends a consent default before Google tags fire, and what changes after a visitor accepts or rejects. Free.

Open the free tool

This guide explains the law in general terms and isn't legal advice. Laws change and how they apply depends on your situation; for high-risk processing, ask a lawyer.

Keep reading

All guides

Get compliant this afternoon, not this quarter.

Set up your policies, banner and request form in one place. Free while Kiescy is in early access.