Skip to Content

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.


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:

ParameterPurpose
ad_storageControls storage of advertising cookies
analytics_storageControls storage of analytics cookies
functionality_storageControls storage for non-essential functional features
personalization_storageControls storage for personalized content, such as recommendations
security_storageControls security-related cookie storage
ad_user_dataControls whether user data can be sent to Google for advertising
ad_personalizationControls 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 gtag is 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:

  1. Go to your GTM container
  2. Add a new tag and choose the CookieHub CMP from the Community Template Gallery
  3. Enter your CookieHub domain code
  4. Set the trigger to Consent Initialization - All Pages
  5. 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 CategoryConsent Mode Parameter
Marketingad_storage, ad_user_data, ad_personalization
Analyticsanalytics_storage
Preferencesfunctionality_storage, personalization_storage
Necessarysecurity_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 ParameterGranted when the user has establishedMapping defined by
security_storageAlways grantedCookieHub
functionality_storagePurpose 1 (Store and/or access information on a device)CookieHub
personalization_storagePurpose 1 and Purpose 6 (Use profiles to select personalised content)CookieHub
analytics_storagePurpose 1 and Purpose 8 (Measure content performance)CookieHub
ad_storagePurpose 1Google
ad_user_dataPurpose 1 and Purpose 7 (Measure advertising performance)Google
ad_personalizationPurpose 3 (Create profiles for personalised advertising) and Purpose 4 (Use profiles to select personalised advertising)Google

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_personalization can 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.

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

FeatureCookieHub 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

Last updated on