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
  • Step 1 - Enable our GTM integration
  • Step 2 - Create the variables in GTM
  • Step 3 - Create triggers
  • Step 4 - Classify your tags
  • Custom events and consent
  1. SDKs
  2. Web SDK
  3. Tags and vendors management
  4. Tags management
  5. Tag managers
  6. Google Tag Manager

Configure the Didomi / GTM integration

PreviousGoogle Tag ManagerNextDidomi's GTM template

Last updated 2 months ago

Events and variables used by GTM are detailed in

To avoid overriding our variables in the dataLayer in the case where Didomi is loaded before the dataLayer initialization, we recommend to instantiate it with this syntax : window.dataLayer=window.dataLayer || []; instead of window.dataLayer=[];

This section describes how to control what tags are embedded on your website when using Google Tag Manager for managing tags.

The key idea of the integration is that Didomi pushes consent information into Google Tag Manager as variables of the data layer. You should then configure GTM to only fire tags after consent has been collected for every vendor.

The integration relies on adding a trigger to all the tags from vendors that do not support the IAB framework to make them fire on a custom event from the data layer. The Didomi SDK will then fire an event with the list of vendors that the user has given consent to, which will ensure that Google Tag Manager only loads the tags matching the user consent.

For instance, if the user gives consent to the vendor google, the SDK will push the event didomi-consent and the variable didomiVendorsEnabled with the value google,. The tags setup in Google Tag Manager and with a trigger "didomiVendorsEnabled" contains "google," will then be loaded by Google Tag Manager and other tags with triggers for a different vendor ID will not be loaded.

Make sure that our SDK is setup

Before continuing, please read our section on to learn how to do the initial setup of your tag. It is particularly important that our tag gets embedded before all the other tags on your page.

Step 1 - Enable our GTM integration

Enable the GTM integration in the Integrations tab of your consent notice by selecting this box:

If you are configuring Didomi through the Console, you can now go to the next step (2 - Create the variables in GTM).

Embedding the Didomi SDK through GTM

We recommend not embedding the Didomi SDK through GTM. By being directly on your pages, the Didomi SDK can load faster and also ensures that IAB vendors can detect a CMP on the page as soon as possible.

Embedding the Didomi SDK through GTM will result in fewer consents being passed to vendors and a lower consent rate from their perspective.

Step 2 - Create the variables in GTM

The Didomi SDK will automatically push variables and events to GTM that contain the user consent status. You can then use these custom variables and events to decide when to load a vendor tag on your website.

First, you need to create a data layer variable that maps to the didomiVendorsEnabled variable for example, that will be pushed by the SDK onto the data layer.

1) Go to the "Folders" section of your Google Tag Manager workspace:

2) Create a new folder named "Didomi"

3) Click on “add new variable”

4) Create new user-defined variables, using the following configuration:

  • Name: Didomi Vendors Consent

  • Variable type: Data Layer Variable

  • Data layer variable name: didomiVendorsEnabled

Note: We recommend keeping Didomi's variables and triggers in a dedicated "Didomi" folder but you are free to structure resources differently.

Step 3 - Create triggers

You need to create triggers that will be used to decide when to load each tag in Google Tag Manager.

For every vendor tag that you need to control, in the "Folders" section of the manager, add a new trigger to the Didomi folder:

And use the following configuration:

  • Trigger name: "{name of the Vendor} – {id of the vendor}" for example (see “how to find your vendor ID” further down in the article)

  • Trigger type: Custom event

  • “This trigger fires on “: Some Custom Events

  • “Fire this trigger when an Event occurs and all of these conditions are true” :Didomi Vendors Enabled contains {id of the vendor},. Use the full ID of the vendor with an additional comma (,) at the end.

  • Save.

When matching vendors by IDs in variables, use the full ID of the vendor with an additional comma (,) at the end to ensure IDs do not get mixed and matched. Example: Use google, to match the vendor with ID google and not the vendor with ID googleana-4TXnJigR.

Repeat this process for every non-IAB vendor that you have. You need to create one trigger per non-IAB vendor.

Otherwise, if you just add another firing trigger related to consent to a tag with an already existing condition, the tag will trigger when condition 1 OR condition 2 are met. But not necessarily both at the same time, and this will not be compliant.

In the "Folders" section of the manager, add a new trigger to the Didomi folder, using the following configuration :

  • Trigger group name : Trigger Group - Consent + {other condition} - {name of the Vendor} – {id of the vendor}

  • Trigger type: “Trigger Group”.

  • Select the existing trigger of your tag.

  • Also select the Didomi trigger for this vendor, that you created in step 3.

  • Save

How to find your vendor ID?

This trigger (or trigger group) can now be used to define tags that fire only when the user has given consent for that vendor.

Following these instructions while also enabling Google Consent Mode, will result in negatively impacting the Consent Mode functionality by blocking the Google tags from firing until consent is granted.

To make sure Google Consent Mode is working, you will have to remove any consent-aware event and only use the didomi-ready event.

Google Consent Mode only supports GDPR. For multi-regulation notices, you may want to duplicate your tags and condition them according to the applicable regulation. To do this, you can use the variable didomiRegulationName.

Alternatively, you could use two GTM containers, one for GDPR, one for the other regulations, and load one or the other based on the applicable regulation.

Step 4 - Classify your tags

You now need to classify your tags and define what user consent is required for firing each of them. This last step is very important.

In the "Tags" section of your Google Tag Manager, edit EACH of your existing tag concerning non-IAB vendors and add the trigger or the trigger group (created at step 3) corresponding to the vendor that owns the tag instead of what was previously used.

Remember to condition the tags of all your containers.

Moving forward, every time you add a new tag that does not implement the IAB specification and that requires GDPR consent, you must categorise it by adding the adequate trigger.

Custom events and consent

By default, Didomi uses the name “dataLayer” as the variable name for your .

If you are using , you can instruct Didomi to use this name instead, by typing it in the “DATA LAYER NAME” field.

Please read for the list of all variables that are pushed to GTM by the Didomi SDK.

Event name: one of the (didomi-consent, didomi-ready or didomi-consent-changed). We recommend using didomi-consent, because this event is merging didomi-consent-changed and didomi-ready. As a result, it will take care of a change of consent and a simple page load.

Then, if your existing trigger is a custom trigger, you will need to create , so that the tag triggers when condition 1 (already existing condition) AND condition 2 (related to consent) are both met.

Note: Please note that trigger groups are triggered once per page only, which can be an issue when using dynamic websites. In that case, you can use our and . And in the specific context of a SPA, you can refer to our dedicated .

To find your vendor ID, in your Didomi account, go to Consent notices -> Open your notice -> Regulation -> Edit vendors and Purposes: copy the API ID. Learn more about variables in

If enabling Google Consent Mode via our , make sure that no consent-aware tags are configured for Google tags (vendors google , googleana-4TXnJigR).

If you have your own custom events that you use as triggers for tags and also want to add an additional condition on the consent status of the user, check for more details.

GTM data layer
another name for your data layer
a Trigger group
functions
events
GitHub page
GCM direct integration
this page
this documentation.
setting up our SDK
this documentation
events pushed by Didomi
this documentation.
GTM integration in the Didomi Console
GTM folders
GTM Didomi variable
New trigger
Trigger group
GTM didomi tag