The Google Consent Mode v2 integration handles consent automatically for Google Analytics 4 and Google Ads. On every page load it applies safe defaults before any Google scripts run by setting all Google consent signals such as analytics_storage and ad_storage to denied. These consent signals are then dynamically update to align with each visitor's privacy preference as they accept or revoke an associated category. The initial consent state for gtag is as follows:
gtag("consent", "default", {
ad_storage: "denied",
ad_user_data: "denied",
ad_personalization: "denied",
analytics_storage: "denied",
functionality_storage: "denied",
personalization_storage: "denied",
security_storage: "granted",
wait_for_update: 2000,
});Before any Google scripts run, the integration blocks all tracking by default and gives Cookie Control up to two seconds to read the visitor's stored preferences — so nothing is tracked before they have made their choices, even on return visits. If you have provided a containerId which can be located on your dashboard on Google Tag Manager, the GTM script is injected at this point with those defaults already in place.
Whenever a visitor accepts or revokes a category, the integration automatically updates the relevant Google consent signals:
| Cookie Control category | Google consent signal |
|---|---|
| analytics | analytics_storage |
| functional | functionality_storage |
| marketing | ad_storage, ad_user_data, ad_personalization |
| preferences | personalization_storage |
Enable Google Consent Mode v2 from the Integrations tab in your Cookie Control Premium dashboard.
You will be prompted for your Google Tag Manager (GTM) Container ID (GTM-XXXXXXX) and by default Cookie Control will handle loading GTM, setting the initial consent state and updating consent changes in accordance with Google Advanced Consent Mode for the categories analytics and marketing.
If you'd like to customise this behaviour, you can adjust the integration settings by clicking Advanced Settings and update aspects such as which categories to include and whether to use advanced or basic consent mode.
If you prefer to deploy Cookie Control through Google Tag Manager (GTM), rather than directly with the Cookie Control Premium core script, you can find our updated guide for setting up the GTM template here.