Google Consent Mode v2
Google Consent Mode v2 allows Google services such as Google Analytics, Google Ads, and Floodlight to adjust their behavior based on user consent choices. It helps website owners comply with data protection laws by informing Google how to operate before and after a user makes a consent decision.
CookieHub integrates with Consent Mode v2 automatically and sets all required consent signals based on the user’s preferences.
What does Google Consent Mode v2 do?
Consent Mode v2 sets parameters that determine how Google tags behave depending on user consent. These parameters are passed directly to Google through the gtag or Google Tag Manager (GTM).
The following parameters are used:
| Parameter | Purpose |
|---|---|
ad_storage | Controls storage of advertising cookies |
analytics_storage | Controls storage of analytics cookies |
functionality_storage | Controls storage for non-essential functional features |
personalization_storage | Controls storage for personalized content, such as recommendations |
security_storage | Controls security-related cookie storage |
ad_user_data | Controls whether user data can be sent to Google for advertising |
ad_personalization | Controls whether ads can be personalized |
CookieHub sets these parameters automatically from the user’s choices: from cookie categories when a region uses CookieHub Choices, and from TCF purposes when it uses the IAB TCF. See Parameter mapping below.
CookieHub integration
CookieHub fully supports Consent Mode v2 and sets the required parameters automatically based on user consent.
- No manual configuration of the
gtagis needed. - Consent signals are passed to Google automatically.
- Works in both HTML and Google Tag Manager (GTM) implementations.
Implementation methods
HTML implementation
When CookieHub is installed directly in your site’s HTML (using the embed script in the <head>), Google Consent Mode is fully supported. Parameters are set automatically before any Google tags execute.
No further setup is needed if tags are placed after the CookieHub script.
Google Tag Manager (GTM) implementation
If you’re using GTM, CookieHub provides a built-in GTM template that enables full Consent Mode support.
To enable it:
- Go to your GTM container
- Add a new tag and choose the CookieHub CMP from the Community Template Gallery
- Enter your CookieHub domain code
- Set the trigger to Consent Initialization - All Pages
- Save and publish
This ensures that Consent Mode is initialized before any tags run, and user preferences are respected.
You must configure additional consent control manually for non-Google tags that do not support Consent Mode. See Installation: Additional Consent.
Parameter mapping
How CookieHub derives each Consent Mode parameter depends on the framework the region uses. Regions on CookieHub Choices map parameters from cookie categories. Regions on the IAB TCF map them from the purposes the user has agreed to.
In both cases the parameters are updated automatically when the user gives or withdraws consent, and ads_data_redaction is set to true whenever ad_storage is denied and cleared again when it is granted.
Category mapping
When a region uses CookieHub Choices, CookieHub maps cookie categories to Consent Mode parameters as follows:
| CookieHub Category | Consent Mode Parameter |
|---|---|
| Marketing | ad_storage, ad_user_data, ad_personalization |
| Analytics | analytics_storage |
| Preferences | functionality_storage, personalization_storage |
| Necessary | security_storage (always allowed) |
IAB TCF purpose mapping
When a region uses the IAB TCF, the consent dialog collects choices per TCF purpose rather than per cookie category, and CookieHub derives the Consent Mode parameters from those purposes. This mapping applies to widget version 2.9.1 and later.
| Consent Mode Parameter | Granted when the user has established | Mapping defined by |
|---|---|---|
security_storage | Always granted | CookieHub |
functionality_storage | Purpose 1 (Store and/or access information on a device) | CookieHub |
personalization_storage | Purpose 1 and Purpose 6 (Use profiles to select personalised content) | CookieHub |
analytics_storage | Purpose 1 and Purpose 8 (Measure content performance) | CookieHub |
ad_storage | Purpose 1 | |
ad_user_data | Purpose 1 and Purpose 7 (Measure advertising performance) | |
ad_personalization | Purpose 3 (Create profiles for personalised advertising) and Purpose 4 (Use profiles to select personalised advertising) |
Notes on the table:
- Rows marked Google follow Google’s official mapping of TCF purposes to Consent Mode . Rows marked CookieHub cover parameters for which Google defines no mapping, and CookieHub applies the closest corresponding TCF purposes.
- Purposes 7 and 8 are satisfied by consent or legitimate interest, since either establishes the purpose under the TCF. Every other purpose in the table requires consent.
ad_personalizationcan only be granted when Purposes 3 and 4 are among the purposes the dialog presents. If the dialog does not offer them, the parameter stays denied.- Purposes 9 (Understand audiences through statistics or combinations of data from different sources) and 10 (Develop and improve services) do not affect any Consent Mode parameter. Google maps them to the Google signals feature in Google Analytics instead.
When is Google Consent Mode v2 required?
Consent Mode v2 is required if:
- You use Google Ads, AdSense, or Google Analytics in the EU, UK, or Switzerland
- You are subject to the Google EU User Consent Policy
- You want to collect analytics or conversion data in compliance with privacy laws
Summary
| Feature | CookieHub Support |
|---|---|
| Consent Mode v2 integration | ✅ Yes |
| HTML script integration | ✅ Yes |
| GTM integration with template | ✅ Yes |
| Parameter mapping to categories | ✅ Yes |
| Parameter mapping to TCF purposes | ✅ Yes |