PactbasePactbase DocsDocs
Integrations

Google Consent Mode v2

Send every Consent Mode signal, mapped from your categories.

The script sends all Google Consent Mode v2 signals, mapped from the visitor's categories.

Google signalCategory
analytics_storageanalytics
ad_storage, ad_user_data, ad_personalizationmarketing
functionality_storage, personalization_storagefunctional
security_storagealways granted

Turn it on

<script src="https://v1.pactbase.in/sdk/v1/pactbase.js" data-org="ORG_ID" data-site="SITE_KEY" data-google-consent-mode="advanced"></script>

With the attribute you add nothing else. Before anything else runs, the script:

  1. Creates dataLayer and gtag if the page has not.
  2. Sends consent default with everything except security_storage denied, and wait_for_update: 500.
  3. Turns on ad data redaction, so ad click ids are stripped while ad_storage is denied.

It sends consent update whenever the visitor decides, and straight after the default on a repeat visit.

Basic or advanced

ModeGoogle tags before consentWhat Google receives
basicHeld back like other trackersNothing until the visitor consents
advancedLoad straight away. Scripts and pings from Google Tag Manager, Google Analytics and Google Ads hosts are never heldCookieless pings, which Google uses to model conversions from visitors who decline

Rules

  • The script must be the first script in <head>, without async, so the default comes before any Google tag.
  • In advanced mode, do not mark Google tags up with data-category. That holds them back and makes it basic.
  • If your page already sent its own consent default first, for example with per-region defaults, the script leaves it alone and only sends updates.
  • Without the attribute, your page must set the default itself, before any Google tag. The script still sends the update calls if the page defines gtag.
  • For Google tags loaded through Tag Manager, use Consent Mode in the container rather than marking each tag up.

On this page