Google Consent Mode v2 Generator
Generate the gtag.js consent-mode default snippet for GA4 and Google Ads: set per-signal defaults and EEA region rules, then copy the code.
Consent Mode v2 Generator
Set per-signal consent defaults and EEA region rules, then copy the gtag.js default snippet
Place this snippet before your Google tag loads, as high in the <head> as possible.
Default consent signals
The four Consent Mode v2 signals. Privacy-safe defaults are denied until the user accepts.
A second gtag('consent','default', { ... 'region': [...] }) block is emitted that applies your denied defaults to these regions. The first block grants the same signals everywhere else.
Advanced
ads_data_redactionurl_passthroughWhat is a Consent Mode v2 generator?
A Consent Mode v2 generator builds the gtag.js snippet that sets your default consent state for Google’s tags before they load. Google Consent Mode v2 is the framework that adjusts how Google Analytics 4 and Google Ads behave based on a user’s consent choices, using four signals: ad_storage, analytics_storage, ad_user_data, and ad_personalization. The default state must be declared before the Google tag fires — typically denied for users in the EEA until they accept — and then updated by your consent management platform after the user responds. This tool lets you set each signal to granted or denied, add region-specific rules for the EEA and UK, enable ads_data_redaction and url_passthrough, and copy a ready-to-paste snippet for either gtag.js or Google Tag Manager. It runs 100% in your browser — nothing you configure is sent to any server. Source: the Google Tag Platform consent documentation.
How to Set Up Consent Mode v2: Step by Step
Consent Mode v2 communicates a user’s consent choices to Google’s tags so they can adjust their behavior. Here is how to generate and install the default snippet.
Set Your Default Consent Signals
Choose granted or denied for each of the four signals: ad_storage, analytics_storage, ad_user_data, and ad_personalization. For GDPR compliance, leave them all denied by default so no consented storage happens before the user accepts.
ad_user_data and ad_personalization on top of the original two signals. All four must be present for Google Ads features such as remarketing and conversion modeling to work.Add Region-Specific Rules (Optional)
Turn on region-specific defaults to deny consent only in selected regions — for example the EEA countries plus the United Kingdom — while granting it elsewhere. This emits a second default block scoped with a region array, so visitors outside those regions are not blocked unnecessarily.
Enable Redaction and URL Passthrough
Optionally turn on ads_data_redaction, which removes ad-click identifiers from pings while consent is denied, and url_passthrough, which preserves ad-click and session information through the URL when cookies are unavailable. Both help preserve measurement under denied consent.
Place the Snippet Before the Google Tag
Copy the generated snippet and place it as high in the <head> as possible, before your gtag.js or Google Tag Manager loader. The default consent state must be set before any Google tag runs, otherwise the tag fires with no consent context.
Update Consent from Your Banner
When the user makes a choice in your consent banner or CMP, call gtag('consent', 'update', { ... }) with the signals set to granted or denied accordingly. The generated snippet includes a commented example of this update call for your CMP to trigger.
Frequently Asked Questions
What is Google Consent Mode v2?
ad_storage, analytics_storage, ad_user_data, and ad_personalization. Version 2 added the last two data-consent signals, which Google requires for ad personalization and remarketing features in the European Economic Area.What are the four consent signals?
ad_storage (cookies and identifiers for advertising), analytics_storage (storage for analytics such as GA4), ad_user_data (consent to send user data to Google for advertising), and ad_personalization (consent for personalized advertising and remarketing). Each is set to granted or denied. The recommended default for users who have not yet consented is denied for all four.Where do I place the consent mode snippet?
<head> as possible, above your gtag.js or Google Tag Manager loader. If you use Google Tag Manager, put the snippet in a Custom HTML tag that fires on the "Consent Initialization – All Pages" trigger, which runs before all other tags. Setting the default after the Google tag has already loaded means the tag fires without a consent state.What is the difference between the default and update consent calls?
default call sets the consent state before the user has chosen anything — usually denied in regulated regions. The update call runs after the user interacts with your consent banner and changes the signals to reflect their choice, for example granting analytics_storage when they accept analytics cookies. You set the default once on page load; your consent management platform calls update each time the user’s choice changes.What does wait_for_update do?
wait_for_update parameter tells Google’s tags how many milliseconds to wait for an asynchronous consent banner to call the update before they proceed with the default state. A common value is 500 milliseconds. It gives a slow-loading consent management platform enough time to register the user’s real choice, while preventing tags from waiting indefinitely.Do I still need a consent banner with Consent Mode v2?
gtag('consent', 'update', ...). This tool generates only the default state and the boilerplate; your banner is responsible for the update call when the user accepts or rejects.More free tools: browse the full catalog →