Skip to main content

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.

SignalDefaultGranted when
ad_storagedeniedAdvertising consent
ad_user_datadeniedAdvertising consent
ad_personalizationdeniedAdvertising consent
analytics_storagedeniedAnalytics consent
functionality_storagedeniedFunctional consent
personalization_storagedeniedPerformance consent
security_storagegrantedAlways 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:

  1. Open the dashboard and select your domain.
  2. Go to Frameworks.
  3. Toggle Google Consent Mode v2.
  4. 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.