What Is Google Consent Mode v2?
Consent mode tells Google tags what a visitor has agreed to. When a visitor says no to cookies, tags stop setting advertising and analytics cookies but can still send basic, cookieless signals. Google then uses those signals to model the conversions and visits you would otherwise lose.
Version 2 added two consent types, ad_user_data and ad_personalization. Google requires them for advertisers who want to keep audience and measurement features for visitors in the European Economic Area. The code this tool writes follows Google's consent mode setup guide for websites.
How to Use the Generator
- Choose where the defaults apply. Most sites deny by default in the EEA, UK and Switzerland and grant elsewhere.
- Set each consent type. Advertising and analytics start as denied. Security storage normally stays granted.
- Keep a short wait.
wait_for_updategives your cookie banner time to load a saved choice before tags fire. 500 ms suits most banners. - Paste the default code into the head of every page, above the Google tag or Tag Manager container.
- Connect the update code to your banner's Accept and Reject buttons, and run it again on each page view once the choice is saved.
The Seven Consent Types
| Consent type | What it controls |
|---|---|
ad_storage | Cookies and storage used for advertising |
analytics_storage | Cookies used for analytics, such as visit length |
ad_user_data | Sending user data to Google for advertising (new in v2) |
ad_personalization | Personalized advertising such as remarketing (new in v2) |
functionality_storage | Storage that makes the site work, such as language settings |
personalization_storage | Storage for personal features such as recommendations |
security_storage | Storage for security, logins and fraud prevention |
Basic or Advanced Consent Mode?
In basic mode, Google tags do not load at all until the visitor accepts, so nothing is sent before consent. In advanced mode, tags load straight away with consent denied and send cookieless pings, which gives Google more data to model with. The default code from this tool works for both. For basic mode, your consent platform also blocks the tags until the visitor accepts.
- Order matters. The default command must run before any
configoreventcommand, or the defaults are ignored. - Region specific defaults win. A default with a
regionlist overrides the general default for visitors in those places. - Test with Tag Assistant. Check that consent shows as denied on load and changes to granted after you accept.
Learn More
Read consent mode v2 explained for website owners, see why first party data and privacy matter more each year, and consider server side tagging for more control. Ready to send events once consent is in place? Use the GA4 event code generator.
Frequently Asked Questions
1Where do I put the consent mode code?
Put the default code in the head of every page, above the Google tag or Google Tag Manager snippet. It must run before any config or event command so the defaults apply to the very first hit.
2Does this replace a cookie banner?
No. Consent mode only passes the visitor's choice to Google tags. You still need a cookie banner or consent management platform to ask for consent and call the update code.
3What does wait_for_update do?
It tells Google tags to wait a set number of milliseconds for an update command before sending data. This gives your banner time to load a choice the visitor made on an earlier visit.
4Is anything I enter uploaded?
No. The code is built in your browser and nothing you type is sent to a server.