Google Consent Mode v2 Code Generator

Google Consent Mode v2 is required for EEA and UK traffic to Google Ads, GA4, and Floodlight: since March 2024. Generate the default-state gtag or GTM code and the update calls your consent banner should fire.
Measurement Intelligence
Without v2 consent signals, Google Ads loses conversion data and remarketing audiences for EEA + UK users.
Consent Mode v2 adds two new signals: ad_user_data and ad_personalization. Both default to denied, and your consent banner must call gtag('consent', 'update', {...}) with the user's actual choice. Without this, EEA/UK conversions are silently dropped. This tool generates the default + update code for gtag.js and GTM.
Default consent states
Starting states (fire before any tag loads)
These are the defaults applied before the user interacts with your banner
Granted state (fire when user accepts)
Configuration
Google waits this long for your banner to call update before firing cookieless pings. 500–2000ms is typical.
URL passthrough
Preserves ad click IDs across pages when storage is denied.
Ads data redaction (when denied)
Prevents your Google Ads tags from sending full IP + user data when consent is denied.
Apply defaults only to these regions. Leave blank for sitewide. Comma-separated ISO codes.
Output format
Generated code
Default consent code (place in <head>, before gtag/GTM)

    
Update code (fire from your consent banner)

    
Next steps
After consent, make sure your events are correctly structured
Consent Mode controls IF events fire. The GA4 Event Generator controls what they look like.
Frequently asked questions
What is Consent Mode v2?
Google's framework for passing user consent signals to Google Ads, GA4, and other Google tools. Required for EEA + UK traffic since March 2024.
What changed from v1 to v2?
v2 adds ad_user_data and ad_personalization as separate consent dimensions: v1 only had ad_storage and analytics_storage.
Is Consent Mode mandatory?
For EEA + UK traffic using Google Ads or Google Analytics with personalisation features, yes. Non-compliance means reduced conversion data for EU users.
What does the generator produce?
Default consent state + update function in gtag format. Deploys at the start of your tag loading so defaults apply before any pixel fires.
Where does the code go?
Before the Google Tag loads. For GTM, in the Consent Initialization tag. For gtag, at the top of the gtag block.
What is "advanced" vs "basic" consent mode?
Advanced: tags load regardless of consent but behave based on signals. Basic: tags only load if consent given. Advanced provides modelled data; basic doesn't.
Do I still need a cookie banner?
Yes. Consent Mode passes signals; it doesn't collect consent. The banner collects consent, Consent Mode delivers it to Google.
What CMPs integrate with Consent Mode v2?
OneTrust, Cookiebot, Didomi, Usercentrics, CookieYes, Osano all support v2 out of the box.
What happens if I don't implement Consent Mode?
EU conversion data in Google Ads drops. Personalisation features turn off. Measurement becomes less accurate.
How to test Consent Mode?
GA4 DebugView shows the consent state. Google Tag Assistant extension reports consent signals.
What about non-EU traffic?
Default to all-granted outside EEA + UK. The generator supports geo-conditional defaults.
Free · no account

SEORCE for Chrome, Edge and Firefox

Audits the page you are on: headings, meta tags, schema, indexability, and whether AI crawlers can read it. Export the result as a PDF. Free, with no account.

It audits one page at a time and does not track AI answers. About the extension

Traffic from search and AI

See which visits came from search and AI.

SEORCE Web Analytics runs from one script tag, with Google Search Console connected. It shows visits from every AI source, from search and from campaigns, and it is free on every plan.
3,000+ users · Free forever plan, no card needed