Didomi - Developers documentation
  • Introduction
  • SDKs
    • Introduction
    • Web SDK
      • Getting started
      • Tags and vendors management
        • Tags management
          • Events & Variables
            • Deprecated
            • Custom events
          • Tag managers
            • Adobe Launch/DTM
            • Eulerian
            • Google Tag Manager
              • Configure the Didomi / GTM integration
              • Didomi's GTM template
            • Tealium
            • Other tag managers
        • Custom Didomi <script> tags
        • Third-party integrations
          • Google Ad Manager / AdSense
            • GDPR via Non-Personalized Ads
              • Share consent and load/refresh ads
              • Share consent without loading or refreshing ads
            • US states laws
          • Google Consent Mode V2
          • Kameleoon
          • Piano Analytics (AT Internet)
          • Prebid
            • GDPR via IAB TCF
            • US states laws
          • Salesforce DMP (Krux)
        • IAB frameworks
        • Programmatic API
      • Configuration
        • Bots (SEO & Performance tools)
        • Configuration by URL
        • Cookies and storage
        • Custom domains for events
        • Notice
          • Behavior
          • Interactions
          • Look and feel
        • Preferences
        • Theme
      • AB tests
      • Custom domain
        • Domain delegation
        • Reverse proxy
      • Share consents between domains
      • Share consents across devices
      • Pass user choices in query string
      • Serve Didomi assets from your domain
      • Reference
        • API
          • Deprecated
        • Events
      • Performance
    • Mobile and TV SDKs
      • Android and Android TV
        • Setup
        • Logging
        • Reference
          • API
            • Deprecated
          • Events
        • Versions
      • iOS and tvOS
        • Setup
        • Logging
        • App Tracking Transparency (iOS 14.5+)
        • Reference
          • API
            • Deprecated
          • Events
        • Versions
      • Unity
        • Setup
        • Reference
        • Versions
        • Troubleshooting
      • React Native
        • Setup
        • Reference
          • Deprecated
        • Versions
      • Flutter
        • Setup
        • Reference
        • Versions
      • Consent notice
        • Getting started
        • Customize the notice
        • Customize the preferences popup
        • Customize the theme & UI
        • Load notice by ID
      • Third-party SDKs
      • Share consents across devices
      • Share consent with WebViews
      • Google Consent Mode v2
      • FAQ
    • AMP SDK
      • Blocking Behaviors
        • Load immediately on page load
        • Load only after consent (positive or negative)
        • Load only after positive consent
      • Consent status for vendors
    • Help & Support
  • API
    • Introduction
      • Authentication
      • Errors
      • Pagination
      • Filters
      • Caching
      • Rate limiting
      • Quotas
      • Translations
    • Data Manager
      • Regulations
      • Configuration Tree
      • Purposes
        • Purposes & Vendors Numerical IDs
      • Preferences Library
      • User Rights
    • Widgets
      • Consent notices
        • Notices
        • Configurations
        • Multi-Regulation Configurations
          • Migration of Existing Notices and API Updates
        • Deployments
        • Tutorials
          • Create and publish a consent notice
          • Create and publish a multi-regulation consent notice
      • Privacy widgets
        • Create a widget
        • Retrieve widgets
        • Edit a widget
          • Content & Design
            • Themes & Shapes
            • Components
              • auth
              • dsar_form
              • footer
              • header
              • preference
              • preference_value
              • save
              • section
              • sections
            • Options
          • Purposes & preferences
          • Settings
        • Deploy a Widget
          • Use your own subdomain
          • Use your own domain
          • Implement an embeddable widget on your website
        • Authentication
          • Manage authentication providers
          • Authenticate your end-user
        • Archive a widget
        • Headless widgets
          • Public Methods
          • Custom elements
          • Custom events
          • Event listeners
        • Tutorial
          • Launch a Preference Center from a mobile app
    • Compliance Reports
      • Properties
      • Reports
      • CSV format reference
      • Websites
    • Consents and Preferences
      • Events
        • Generate IAB TCF consent string
      • Links
      • Proofs
      • Tokens
      • Secrets
      • Users
      • Tutorial
        • Collect and operate data
    • Privacy Requests
      • Requests
      • Notes
      • Links
      • Emails
  • Integrations
    • Introduction
      • Quotas
    • Generic integrations
      • Batch export
        • Destinations
          • AWS S3 Bucket (owned by Didomi)
          • GCP Storage Bucket
        • Exported data
          • Notices consents
        • Logs
      • Webhooks
      • Batch import
      • Analytics export
        • Destinations
          • AWS S3 Bucket (owned by Didomi)
          • GCP Storage Bucket
    • Third-party apps
      • CMP integrations
        • Didomi-mParticle integration for your CMP
        • Deploy Didomi’s SDK for your Adobe Commerce website
      • Preference Management Platform integrations
        • Actito
        • Adobe Campaign Classic
        • Adobe Experience Cloud
        • Adobe Marketo Engage
        • Adobe Source Connector
        • Braze
        • Dotdigital
        • Hubspot
        • Mailchimp
        • Microsoft Dynamics 365
        • Salesforce Marketing Cloud
        • Salesforce Sales & Service Cloud
        • Selligent
        • Brevo (ex Sendinblue)
    • Tutorials
      • Configure a HTTP webhook
      • Configure a batch export
      • Configure an analytics export
    • Emailing
      • Configurations
        • Actito Email
        • Actito SMS
        • Adobe Campaign Classic
        • Adobe Campaign Standard
      • Emails
        • Templates
        • Manage your templates
Powered by GitBook
On this page
  • Configure the Didomi tag
  • Enable the Didomi / Google integration
  • Display ads before collecting consent
  • Google's additional consent mode (IAB TCF)
  • Configure your Google account
  • Ad Manager account configuration
  • AdSense account configuration
  • Configure Google tags for loading and refreshing ads
  • Ad Manager macros
  • Configuration
  • Variables
  • Macros in creatives
  1. SDKs
  2. Web SDK
  3. Tags and vendors management
  4. Third-party integrations
  5. Google Ad Manager / AdSense
  6. GDPR via Non-Personalized Ads

Share consent without loading or refreshing ads

PreviousShare consent and load/refresh adsNextUS states laws

Last updated 1 year ago

Our integration with Google Ad Manager which relies on passing an NPA parameter to ad requests is still available in the Didomi Console. But we do not advise using it. Please review our Google Ad Manager implementation recommendation . This module does not support automatically passing CCPA Do Not Sell Status to Google products yet. See for more information.

Didomi supports sharing consent with Google Ad Manager, AdSense and Ad Exchange asynchronous ad tags. When the user gives consent, the Google tags are configured to fetch personalized ads.

With this integration, Didomi shares consent with Google Ad Manager/AdSense but does not load or refresh ads. This allows you to fully control the ad workflow on your pages and build more complex use cases like include Prebid auction results into your Ad Manager ad slots, for instance.

For this integration to work, you need to make sure that you are delaying the loading of Google ads until Didomi has shared the consent information with Google. You must also synchronize the ad calls to ensure that consent is passed before the ads are loaded on the page.

Configure the Didomi tag

If you are using the Didomi Console to manage your consent notices, you can manage the Google integration from there and can skip this tag configuration section.

You must ensure that the Didomi tag gets embedded first on your pages and configure it to communicate with the Google tag.

Enable the Didomi / Google integration

Make sure that you add the following vendors to your tag (in the app.vendors property):

  • googleas a Didomi vendor (app.vendors.didomi property)

  • All the "ad technology providers" enabled in your Google account (see the or the ). They can be added as IAB vendors (recommended if they are in the list), Didomi or custom vendors, and must appear in the list for the consent to be valid.

You also need to enable the specific integration with Google with the property integrations:

<script type="text/javascript">
window.didomiConfig = {
  app: {
    apiKey: '<Your API key>',
    vendors: {
      iab: {
        include: [
          ..., // All the vendors that you have enabled as ad technology providers in your Google account
        ]
      },
      didomi: [
        // Ask Didomi to collect consent for Google
        'google'
      ]
    }
  },
  
  integrations: {
    vendors: {
      // Setup the integration with Google (ask Didomi to share consent with Google tags)
      google: {
        enable: true,
        refresh: false // Tell the SDK to never load/refresh ads and only share consent with Google
      }
    }
  }
};
</script>

This configuration will tell the Didomi tag to automatically share consent with Google and never load or refresh ads (ie the Didomi SDK will never call window.googletag.pubads().refresh() ).

integrations.google is required

It is used to tell the Didomi SDK to enable the integration with the Google tag. If you do not add that object, consent will be collected for Google but will not be shared with their tag.

Display ads before collecting consent

As a result, no ad request should be sent to Google (and no ad displayed) until the user has given consent for the cookies purpose. This is the recommended behavior. The Didomi SDK will always share the consent status with Google and you are in charge of deciding when ads should actually be displayed.

Google's additional consent mode (IAB TCF)

It allows collecting consents for Google Ad vendors which are currently not part of the IAB TCF but are part of Google's Ad Tech Providers list (ATP).

Additional consent string format

The additional consent string contains 4 parts:

  • A specification version number, such as "2"

  • A separator symbol "~"

  • A dot-separated list of user-consented Google Ad Tech Provider (ATP) IDs. Example: "1.35.41.101"

  • A separator symbol "~"

  • "dv." followed by a dot-separated list of disclosed Google Ad Tech Provider (ATP) IDs. Example: "dv.9.21.81"

For example, the AC string 2~1.35.41.101~dv.9.21.81 means that the user has consented to ATPs with IDs 1, 35, 41 and 101, ATPs with IDs 9, 21, and 81 have been disclosed to the user and the string is created using the format defined in the v2 specification.

Configure your Google account

Whether you are using Ad Manager or AdSense, your need to configure your account to allow personalized ads.

Ad Manager account configuration

The Didomi CMP will take care of enabling personalized or non-personalized ads on a per-request basis but your account must be configured to allow serving personalized ads. Otherwise, only non-personalized ads will be served no matter what the consent status of the user is.

Also not that you must identify all the vendors used by Google for serving ads and add them to your Didomi tag configuration to make sure that consent is collected for everyone of them.

AdSense account configuration

The Didomi CMP will take care of enabling personalized or non-personalized ads on a per-request basis but your account must be configured to allow serving personalized ads. Otherwise, only non-personalized ads will be served no matter what the consent status of the user is.

Also not that you must identify all the vendors used by Google for serving ads and add them to your Didomi tag configuration to make sure that consent is collected for everyone of them.

Configure Google tags for loading and refreshing ads

The Didomi SDK will automatically share the user consent status with Google and you must ensure that ads do not get loaded before Didomi has done so.

The SDK exposes the event integrations.consentpassedtodfp to be notified when the user consent status has been shared with Google. Once that is done, you can resume your ad operations and load or refresh your ads as needed:

/**
 * Add an event listener to get notified once Didomi has passed
 * the user consent status to Google
 * Important: this must be placed before the Didomi SDK gets embedded on your
 * website to guarantee that you do not miss any event
 */
window.didomiEventListeners = window.didomiEventListeners || [];
window.didomiEventListeners.push({
  event: 'integrations.consentpassedtodfp',
  listener: function (data) {
    // Consent has been passed to Google
    // Load or refresh ads as needed with Ad Manager, Prebid, etc.
    // `data.consentStatus` contains the current consent status of the user (true/false/undefined)
    // `data.index` contains the index of the event (integer)
    if (data.index === 0) {
      // This is the very first event on the page that gets triggered on page load
    } else {
      // This is an event that happens later on the page, after a user action (user giving consent or changing their preferences)
    }
  }
});

The integrations.consentpassedtodfp event is triggered every time the user consent status changes and can be called multiple times on a single page. For instance, the very first time a user visits your website, this event will be called twice on the page: once with an undefined consent status (and index 0) and a second time, after the user has given consent, with a true consent status (and index 1).

The data object provided to your listener contains the current user consent status for Google as well as the index of the event so that you can decide to only react to some consent statuses. The index is the number of the event on the page. There is always a first event that gets triggered with index 0 on page load. More events can be triggered if the user changes their consent preferences on the page and the index gets incremented by 1 for every event triggered.

The cases that commonly need to be taken into account when deciding to load or refresh ads are the following:

Consent status
Index
Case

true / false

0

User visits a page and has already made a consent choice on a previous page so that the consent status is immediately available.

undefined

0

User visits your website for the first time and has not made a consent choice yet.

true / false

>0

User is on the page and has made a new consent choice.

Fast loading of ads outside of the EU (if you are not an EU company)

If you want to optimize your ad delivery, you can decide not to delay the loading of ads when the user is outside of the EU and not rely on Didomi for that. If your company is based in the EU then you must apply GDPR to all visitors and cannot leverage this option.

Ad Manager macros

Configuration

Console

If you manage your consent notices through the Didomi Console, make sure to enable the "Pass IAB consent string and GDPR status as targeting variables to creatives" option for the Google Ad Manager integration.

Tag

If you manage the Didomi tags yourself, set the integrations.vendors.google.passTargetingVariables to true to configure the SDK to pass targeting variables to Ad Manager.

<script type="text/javascript">
window.didomiConfig = {
  app: {
    apiKey: '<Your API key>',
    vendors: {
      iab: {
        include: [
          ..., // All the vendors that you have enabled as ad technology providers in your Google account
        ]
      },
      didomi: [
        // Ask Didomi to collect consent for Google
        'google'
      ]
    }
  },
  
  integrations: {
    vendors: {
      // Setup the integration with Google (ask Didomi to share consent with Google tags)
      google: {
        enable: true,
        eprivacy: true,
        passTargetingVariables: true
      }
    },
  }
};
</script>

Variables

The Didomi SDK pushes the following variables:

Variable name
Description
Macro

iabconsentstring

Current IAB consent string of the user

%%PATTERN:iabconsentstring%%

iabgdprapplies

Whether the GDPR applies to the current user (0 = No / 1 = Yes)

%%PATTERN:iabgdprapplies%%

Macros in creatives

Example:

The creative code

https://vendor.com/creative?gdpr_consentstring=%%PATTERN:iabconsentstring%%&gdpr_status=%%PATTERN:iabgdprapplies%%

will be rendered as the following code when the creative gets served

https://vendor.com/creative?gdpr_consentstring=SWFtYWNvbnNlbnRzdHJpbmc=gdpr_status=1

According to and to be compliant with the ePrivacy directive from 2002/2009, even when configured to serve non-personalized, their tags still use cookies for "frequency capping, aggregated ad reporting, and to combat fraud and abuse".

The Didomi SDK supports .

You can find the latest Google's Ad Tech Providers (ATP) list .

Sign into Google Ad Manager, go to Admin EU user consent and ensure that your account is setup for serving personalized ads (see instructions from Google on ).

Sign into Google AdSense, go to Allow & block ads Content All my sites EU user consent and ensure that your account is setup for serving personalized ads (see instructions from Google on ).

Didomi can pass the IAB consent string and the GDPR status to Ad Manager as . These variables can be used in creative snippets with to pass the IAB consent string to creatives/vendors served through Ad Manager creatives.

You can use to pass the IAB consent string and GDPR status to a creative.

here
https://support.google.com/adsense/answer/9598414
Google Ad Manager documentation
Google AdSense documentation
Google's documentation
Google's additional consent mode
here
page-level custom targeting variables
pattern match macros
pattern match macros
https://support.google.com/dfp_premium/answer/7673898
https://support.google.com/adsense/answer/7670013