// Free Tool · Privacy & GA4

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.

Google Consent Mode v2

Consent Mode v2 Generator

Set per-signal consent defaults and EEA region rules, then copy the gtag.js default snippet

Implementation method

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.

ad_storage
Cookies and identifiers for advertising.
analytics_storage
Cookies and storage for analytics (GA4).
ad_user_data
Consent to send user data to Google for ads.
ad_personalization
Consent for personalized advertising / remarketing.

How long Google waits for your consent banner to update the signals before proceeding. 500 ms is the common default.

Region-specific defaults
Apply the denied defaults only to selected regions (e.g. the EEA + UK) and grant elsewhere.

Advanced
ads_data_redaction
Redact ad click identifiers in pings while consent is denied.
url_passthrough
Pass ad-click and session info through the URL when cookies are denied.
Ready
Quick presets

What 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.

1

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.

Tip: Consent Mode v2 added 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.
2

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.

3

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.

4

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.

Tip: In Google Tag Manager, paste the snippet into a Custom HTML tag set to fire on the "Consent Initialization – All Pages" trigger so it runs before every other tag.
5

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?
Consent Mode v2 is Google’s framework for adjusting how its tags — Google Analytics 4 and Google Ads — behave according to a user’s consent choices. It uses four signals: 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?
The four Consent Mode v2 signals are 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?
The default consent snippet must run before any Google tag loads. Place it as high in the <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?
The 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?
The 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?
Yes. Consent Mode v2 is not itself a consent banner or a consent management platform — it is the mechanism that relays consent decisions to Google’s tags. You still need a CMP or banner to collect the user’s choice and to call 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 →