How to Set Up Google Consent Mode v2 Defaults on Your Site
Your site loads Google Analytics 4 or Google Tag Manager, but no Consent Mode default is declared. Google tags start before they know whether the visitor has agreed to cookies. By the end of this guide, a `gtag('consent','default', …)` command will run before your Google tags, and your cookie banner will send an update when visitors make a choice.

Why it matters
Without a consent default, GA4 and Google Ads tags set cookies and send identifiers before the visitor has chosen anything. That is a GDPR/ePrivacy risk in the EEA, UK and Switzerland. Since March 2024, Google also requires Consent Mode v2 signals (ad_user_data, ad_personalization) for EEA traffic.
Without them, remarketing audiences and conversion measurement for those users stop working. With a correct default, denied visitors send cookieless pings that Google uses for conversion and behavioral modeling, so you recover part of the data a hard block would lose.
What you need
Step-by-step fix
Locate where your Google tags load
id=GTM-`. Note which file or setting outputs each one: a theme header, a plugin, an app or a hard-coded layout. The consent default has to be placed above the earliest of these.
Also check whether more than one source loads Google tags, for example a plugin and a manual snippet. Each one needs to sit below the default.
Decide your default consent states and regions
Choose what each consent type should be before the visitor answers. The usual setup is to deny everything by default in regions that require opt-in, and grant it elsewhere if your legal advice allows. The four required v2 keys are:
ad_storage– advertising cookiesad_user_data– sending user data to Google for adsad_personalization– remarketing and personalized adsanalytics_storage– analytics cookies
You can scope a default to specific countries with the region parameter, using ISO 3166-1 codes.
// Denied for EEA, UK and Switzerland; granted elsewhere (confirm with your legal team)
gtag('consent', 'default', {
ad_storage: 'denied', ad_user_data: 'denied', ad_personalization: 'denied',
analytics_storage: 'denied',
region: ['AT','BE','BG','HR','CY','CZ','DK','EE','FI','FR','DE','GR','HU','IS','IE','IT','LV','LI','LT','LU','MT','NL','NO','PL','PT','RO','SK','SI','ES','SE','GB','CH'],
wait_for_update: 500
});
gtag('consent', 'default', {
ad_storage: 'granted', ad_user_data: 'granted', ad_personalization: 'granted',
analytics_storage: 'granted'
});Add the consent default before your Google tags
js or GTM snippet. It defines dataLayer and gtag() and queues the default, so Google tags read it as soon as they load. wait_for_update: 500 gives your banner 500 ms to send a stored choice before tags fire.
Keep the code inline rather than in a deferred or async external file, because a late default is the same as no default.
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {
ad_storage: 'denied',
ad_user_data: 'denied',
ad_personalization: 'denied',
analytics_storage: 'denied',
wait_for_update: 500
});
gtag('set', 'ads_data_redaction', true);
gtag('set', 'url_passthrough', true);
</script>
<!-- Google tag (gtag.js) or GTM snippet goes BELOW this line -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>Send a consent update from your cookie banner
When the visitor clicks Accept, Reject or saves preferences, your banner must call gtag('consent','update', …) with the new states. Store the choice in a first-party cookie or localStorage. On later page views, send the update straight after the default, before the 500 ms wait ends, so returning visitors aren't treated as denied.
Most CMPs (Cookiebot, CookieYes, Complianz, OneTrust, Usercentrics) do this for you once you enable their "Google Consent Mode v2" option.
<script>
function applyConsent(c){
gtag('consent', 'update', {
ad_storage: c.ads ? 'granted' : 'denied',
ad_user_data: c.ads ? 'granted' : 'denied',
ad_personalization: c.ads ? 'granted' : 'denied',
analytics_storage: c.analytics ? 'granted' : 'denied'
});
}
// On page load: re-apply a stored choice
var saved = localStorage.getItem('exampleco_consent');
if (saved) applyConsent(JSON.parse(saved));
// Call from your banner buttons:
function onBannerSave(c){
localStorage.setItem('exampleco_consent', JSON.stringify(c));
applyConsent(c);
}
</script>Configure consent in Google Tag Manager (if you use it)
In GTM, go to Admin > Container Settings and tick Enable consent overview. Then click the shield icon on the Tags page to set additional consent checks for any non-Google tags, such as the Meta Pixel or Hotjar. If your CMP offers a GTM template (Templates > Search Gallery), add it with the trigger Consent Initialization - All Pages so it sets defaults before every other trigger.
Keep your inline <head> default from step 3 as well, or confirm the CMP template writes a consent/default entry to the dataLayer. That way the default is visible on the page and not only inside the container.
Check the result in Tag Assistant and DevTools
com, and select the first event (Consent or Consent Initialization). The Consent tab should list all four types with an On-page Default of Denied before you interact with the banner. Then accept the banner and confirm the On-page Update changes to Granted.
js or config` entries.
// Paste in the DevTools console dataLayer.filter(e => e[0] === 'consent').forEach(e => console.log(e[1], JSON.stringify(e[2])));
Platform-specific notes
WordPress
Use a CMP plugin with Consent Mode v2 built in, such as Complianz, CookieYes or Cookiebot. Turn on its Google Consent Mode setting. If you use Site Kit by Google, enable consent mode under Site Kit > Settings > Admin Settings and install the WP Consent API plugin so the banner can talk to Site Kit. For a manual snippet, use WPCode: add an HTML snippet set to Site Wide Header with a low priority number such as 1, so it prints before your analytics plugin's code.
Shopify
If you use Shopify's own cookie banner (Settings > Customer privacy > Cookie banner) together with the Google & YouTube app, Consent Mode signals are passed automatically through the Customer Privacy API. For hard-coded GA4/GTM, open Online Store > Themes > … > Edit code > layout/theme.liquid and place the default script directly above {{ content_for_header }}. Checkout and customer-event pixels run in a sandbox and need their own consent handling.
Next.js
In the App Router, add the default in app/layout.tsx using next/script with strategy="beforeInteractive" (or an inline <script dangerouslySetInnerHTML> inside <head>). Place it before <GoogleTagManager> or <GoogleAnalytics> from @next/third-parties. Scripts using afterInteractive or lazyOnload run too late to act as the default.
Wix
Wix applies Google Consent Mode automatically when the built-in banner is enabled under Settings > Privacy & Cookies > Cookie Banner and GA4/GTM is connected through Marketing Integrations. Don't add a second manual default through Custom Code, because conflicting defaults cause unpredictable behavior.
Cloudflare Zaraz
If Zaraz loads your Google tools, enable Zaraz > Consent > Consent Management and turn on Google Consent Mode in the GA4 or Google Ads tool settings. Zaraz runs tags server-side, so make sure the consent purposes are mapped to each tool.
Check that it worked
✅ How to verify
- Re-run the audit: the check should pass with "Consent Mode default (gtag('consent','default')) is set."
- In Tag Assistant's Consent tab, all four consent types show an On-page Default value on the first event, and an Update after you click the banner.
- In DevTools > Network, collect requests show gcs=G100 before consent and gcs=G111 after accepting, and no _ga cookie is created while analytics_storage is denied.
- In Google Ads, open Tools > Data manager > Diagnostics (or the conversion action's diagnostics) and confirm Consent Mode is reported as active within a few days.
⚠️ Common mistakes
- Placing the default after the gtag.js or GTM snippet, or loading it in a deferred or async file, so tags fire before any default exists.
- Setting only ad_storage and analytics_storage and omitting the v2 keys ad_user_data and ad_personalization, which Google needs for EEA ads features.
- Having the banner call 'default' again instead of 'update', or failing to re-apply a stored choice on later pages, so returning visitors are tracked as denied.
- Loading Google tags from two places (a plugin and a manual snippet), where only one of them sits below the consent default.
Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.
Check my site freeFAQ
What is the difference between basic and advanced Consent Mode?
In basic mode, Google tags are blocked entirely until the visitor consents, so nothing is sent for people who decline. In advanced mode, tags load with the denied default and send cookieless pings without identifiers, which Google uses to model conversions and behavior. This guide sets up advanced mode. To get basic mode, block your Google tags in the CMP until consent is given.
Do I need Consent Mode if my visitors aren't in Europe?
Google only requires it for EEA and UK traffic to use ads personalization and measurement features. However, privacy laws in places like California, Quebec and Brazil also cover tracking. A regional default lets you deny in opt-in regions and grant elsewhere, so you are covered without losing data where consent isn't required.
Does Consent Mode replace a cookie banner?
No. Consent Mode only tells Google tags what the visitor decided. You still need a banner or CMP to collect that decision and send gtag('consent','update'). It also doesn't control non-Google tags such as the Meta Pixel, which your CMP or GTM consent checks must block separately.
Will Consent Mode lower my GA4 numbers?
Reported users and sessions from denied visitors drop, because no cookies are set for them. If your GA4 property meets the traffic thresholds for behavioral modeling, GA4 fills part of the gap with modeled data. You can switch to the Blended reporting identity under Admin > Data display > Reporting identity.
How to Enable HTTPS and Redirect Your Site from HTTP
How to Fix a Missing Cookie Consent Banner for Tracking Tags
How to Fix the HTTP to HTTPS Redirect (301) on Your Site
How to Fix Legacy Universal Analytics (UA-) Tracking Code
How to Fix Mixed Content Warnings on an HTTPS Website
How to Fix Duplicate Analytics Tags (Google Tag Loaded Twice)