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
      • Versions
    • 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
  • Overview
  • Configure the integration
  • Step 1 - Website configuration
  • Step 2 - Delay initializing your tag manager
  • Step 3 - Create rules in your tag manager
  1. SDKs
  2. Web SDK
  3. Tags and vendors management
  4. Tags management
  5. Tag managers

Other tag managers

PreviousTealiumNextCustom Didomi <script> tags

Last updated 1 year ago

This section explains how to integrate Didomi with any tag manager that we do not have a direct integration with. This allows you to to use consent information in rules when deciding whether a tag can be loaded or not directly from your tag manager.

Events and variables are detailed in

Overview

Didomi stores variables on the window.didomiState object with the consent information from the user. A custom tag manager integration requires passing that consent information to the data layer of the tag manager, to be able to create tag-loading rules based on the user consent status.

With this guide, you will:

  • Pass consent information from Didomi to the data layer of your tag manager

  • Create rules in your tag manager to only load tags when consent is granted

  • Delay loading of your tag manager and/or tags that require consent

Configure the integration

Step 1 - Website configuration

Option A - Dynamic data layer - Update the data layer on your website

If your tag manager supports dynamically passing variables to the data layer after page load, this is the best option to leverage as you will not need to delay your tag manager initialization.

The Didomi SDK stores a copy of the user consent status in variables on the window.didomiState object. To get started, update the data layer on your website to pass variables from Didomi to your tag manager after the Didomi SDK is ready:

<script type="text/javascript">
window.didomiOnReady = window.didomiOnReady || [];
window.didomiOnReady.push(function (Didomi) {
    window.updateDataLayer({      
      // Didomi variables  
      didomiRegulationName: window.didomiState.didomiRegulationName,
      didomiVendorsEnabled: window.didomiState.didomiVendorsEnabled,
      didomiVendorsDisabled: window.didomiState.didomiVendorsDisabled,
      didomiVendorsUnknown: window.didomiState.didomiVendorsUnknown,
      didomiPurposesEnabled: window.didomiState.didomiPurposesEnabled,
      didomiPurposesDisabled: window.didomiState.didomiPurposesDisabled,
      didomiExperimentId: window.didomiState.didomiExperimentId,
      didomiExperimentUserGroup: window.didomiState.didomiExperimentUserGroup,
      didomiGDPRApplies: window.didomiState.didomiGDPRApplies,
      didomiIABConsent: window.didomiState.didomiIABConsent,
      
    };
});
</script>

updateDataLayer is an example function name. Your tag manager will have its own way of passing custom variables to the data layer dynamically.

Notice how the data layer is updated in a didomiOnReady handler. This guarantees that the Didomi consent status is available in the didomi* variables when the data layer for your tag manager gets updated.

Option 2 - Static data layer - Update the data layer on your website

Some tag managers load variables into the data layer only on page load and do not have an option to dynamically pass variables later in the page lifecycle. As a result, you will need to update your website configuration to delay loading the tag manager and set the dataLayer variable only after Didomi is loaded on the page.

The Didomi SDK stores a copy of the user consent status in variables on the window.didomiState object. To get started, update your dataLayer JavaScript on your website to pass variables from Didomi to your tag manager after the Didomi SDK is ready:

<script type="text/javascript">
window.didomiOnReady = window.didomiOnReady || [];
window.didomiOnReady.push(function (Didomi) {
    window.dataLayer = {
      // Keep your existing variables here
      firstVariable: 'content',
      secondVariable: 'content',
      ...
      
      // Add Didomi variables
      didomiRegulationName: window.didomiState.didomiRegulationName,
      didomiVendorsEnabled: window.didomiState.didomiVendorsEnabled,
      didomiVendorsDisabled: window.didomiState.didomiVendorsDisabled,
      didomiVendorsUnknown: window.didomiState.didomiVendorsUnknown,
      didomiPurposesEnabled: window.didomiState.didomiPurposesEnabled,
      didomiPurposesDisabled: window.didomiState.didomiPurposesDisabled,
      didomiExperimentId: window.didomiState.didomiExperimentId,
      didomiExperimentUserGroup: window.didomiState.didomiExperimentUserGroup,
      didomiGDPRApplies: window.didomiState.didomiGDPRApplies,
      didomiIABConsent: window.didomiState.didomiIABConsent,
    };
});
</script>

dataLayer is an example variable name. Your tag manager will have its own naming for data layer variables.

Notice how the dataLayer variable is defined in a didomiOnReady handler. This guarantees that the Didomi consent status is available in the didomi* variables when the external variables for your tag manager get registered.

Step 2 - Delay initializing your tag manager

If you are using a static data layer, you will need to delay the initialization of your tag manager to make sure that the user consent status is available in the data layer when tags get evaluated and loaded.

If you are using a dynamic data layer, you usually do not need to implemented this step.

Didomi creates the window.didomi* variable when the SDK is done loading. You must delay your tag manager until Didomi is ready or the variables holding the consent status will be undefined.

To delay your tag manager, update your <script> tags that load your tag manager to execute after Didomi is loaded. For instance:

<script type="text/javascript" src="/path/to/tagmanager.js"></script>

becomes:

<script type="didomi/javascript" src="/path/to/tc_script.js"></script>

Notice how we replaced the script type text/javascript with didomi/javascript. This will ensure that your tag manager only gets included after Didomi is ready.

Step 3 - Create rules in your tag manager

Now that your data layer is setup, you are able to access the user consent status collected by Didomi in your tag manager.

You need to create rules on your tags that require consent to only load after consent is given by the user. How to do that depends on your tag manager and we can only provide a generic outline of the setup.

Generally, you will create rules that depend on the didomiVendorsEnabled and that constrain a tag to be loaded only if that variables contains a specific value indicating that the user has given consent for that vendor.

For instance, if you want to load Google Ads only if the user has given consent to the vendor Google, you will create a rule that only embeds ads into the page if the didomiVendorsEnabled data layer variable contains "google,".

for more information on this feature.

this documentation.
Read our documentation