Google Consent Mode v2
Google Consent Mode v2 is Google's API for passing visitor consent to Google tags (Analytics, Ads, Tag Manager, AdSense). OptSens sets all seven consent types automatically. No extra tagging is needed once the banner is installed.
What OptSens does on the wire
OptSens calls gtag('consent', 'default', ...) before any Google tag loads,
then gtag('consent', 'update', ...) after the visitor makes a choice. It also
sets gtag_enable_tcf_support, which lets Google tags read the TC string when
IAB TCF is active.
The defaults deny everything except security_storage, with a
wait_for_update of 500 ms, and Google tags hold until the banner resolves.
| Signal | Default | Granted when |
|---|---|---|
ad_storage | denied | Advertising consent |
ad_user_data | denied | Advertising consent |
ad_personalization | denied | Advertising consent |
analytics_storage | denied | Analytics consent |
functionality_storage | denied | Functional consent |
personalization_storage | denied | Performance consent |
security_storage | granted | Always granted |
In CCPA (opt-out) regions, OptSens raises the defaults: analytics_storage,
functionality_storage, and personalization_storage start granted, while the
three ad signals stay denied until the visitor opts in. See
geo rules.
Optional settings, sent only when configured: developer_id,
url_passthrough, and ads_data_redaction.
On every consent update OptSens also pushes an OptSensConsentUpdate event to
window.dataLayer with the active categories, for GTM triggers. See
GTM dataLayer.
How to enable it
Google Consent Mode v2 is on by default. To check or change it:
- Open the dashboard and select your domain.
- Go to Frameworks.
- Toggle Google Consent Mode v2.
- Save.
This toggle is marked Recommended for any site using Google products.
How to verify it
Open your site, then run this in the browser console:
window.dataLayer.filter(function (e) {
return e[0] === 'consent';
});
You should see a default entry with all signals denied, then an update
entry after you accept or reject in the banner.
To confirm the dataLayer event fired:
window.dataLayer.filter(function (e) {
return e.event === 'OptSensConsentUpdate';
});
For an automated check that the defaults and updates fire in the right order, run the Consent Mode check from the Integration page in the dashboard.