PubConsent
Web Standard Integration

Gtag Integration (Consent Mode)

4min

The following guide shows how to send the update consent signal to gtag through the mapping offered by PubConsent.

This documentation is intended to provide a detailed overview of each setting in Google’s Consent Mode, strictly following the explanations and guidelines as provided by Google. It does not imply that the Consent Mode settings are designed to satisfy or address any particular regulatory requirements.

The complete explanation of how Google's consent mode works is available at the following link: https://support.google.com/google-ads/answer/10000067

Before following this guide, make sure that the PubConsent integration code available in the configurator is present on the page.

Make sure you have followed the steps provided by the Google documentation at the following link: https://developers.google.com/tag-platform/security/guides/consent?consentmode=advanced

Add the following script to set the default consent status, before the CMP script integration code:

JS


The call shown must be the first call to the gtag method, even before the call: gtag('config', <code>).

After configuring the default state of the consent mode, you need to configure the callback that will allow you to execute the update with the values of the consent mode taken from the user's consent.

JS


Consents' Mapping (Google Consent Mode)

To know which user choices correspond to Google's consent types, here's the corresponding mapping we provide:

CMP Type: GDPR TCF
CMP Type: Google Consent Mode
  • ad_storage -> TCF Purpose 1
  • ad_user_data -> TCF Purpose 1 e 7
  • ad_personalization -> TCF Purpose 3 e 4
  • analytics_storage -> Cookie Measurement
  • functionality_storage -> Cookie Feature
  • personalization_storage -> Cookie User Experience
  • security_storage -> Cookie Feature