> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kameleoon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Didomi

> Integrate Didomi CMP with Kameleoon to automatically manage visitor consent and run A/B tests on different versions of your consent notice.

Didomi builds technology that lets organizations place customer consent at the core of their strategy by offering a powerful Consent Management Platform (CMP) that organizations can deploy on websites or mobile apps.

Kameleoon reads consent policies within the Didomi platform, so you can run A/B tests and personalize the performance of a configuration variant (for example, notice format, content, banner vs. pop-in).

**Key benefits:**

* Automatically manage user consent through Didomi CMP with no additional setup needed.
* Deploy different variants of the Didomi tag configuration through Kameleoon and automatically measure the difference in consent rates.

> [!NOTE]
>
> [Kameleoon is also IAB TCF compliant](https://docs.kameleoon.com/user-manual/integrations/as-a-source/cmp/iab-transparency-and-consent-framework.md)

## Integration with Didomi CMP

Kameleoon provides custom integration with Didomi CMP. Kameleoon automatically reads the consent policy within the Didomi platform for both Kameleoon's experimentation and personalization modules.

With Kameleoon's integration, you can also run A/B tests to test a variant's performance (for example, notice format, content, and banner versus pop-in).

## Enable Didomi in Kameleoon

First, you need to add Kameleoon as a vendor in Didomi's CMP.

### Configure your Didomi notice

[Follow this documentation provided by Didomi](https://developers.didomi.io/cmp/web-sdk/third-parties/direct-integrations/kameleoon)

### Configure Didomi in Kameleoon

> [!WARNING]
>
> You need to trigger the Kameleoon snippet independently of Didomi and add it directly to the source code of the page to prevent flickering in your experiments and personalizations.

1. Log in to your Kameleoon account.
2. Click **Admin** > **Projects**.
3. Click **Edit** on your project's row.
4. Click the **Scripts** tab.

![The Scripts tab with the Global custom script and Variation selection script editors](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/manage-your-projects/project-scripts.png)

#### Global custom script

The **Global custom script** insert lets you link Kameleoon to Didomi. Kameleoon executes any JavaScript code you add in this insert every time the page loads. This feature is often used to add a complex tracking code or integration to other solutions.

To activate the bridge between Kameleoon and Didomi, click **Edit** next to **Global custom script**, then copy and paste the code below into the editor:

```javascript theme={null}
window.didomiOnReady = window.didomiOnReady || [];

window.didomiOnReady.push(function (Didomi) { 

    if (Didomi.isConsentRequired()) {

        Didomi.getObservableOnUserConsentStatusForVendor('c:kameleoon-experiment')

            .subscribe(function (consentStatusForVendor) {

                if (consentStatusForVendor === true) {

                   Kameleoon.API.Core.enableLegalConsent("AB_TESTING");

                   console.log("Enabling A/B Testing");

                } else if (consentStatusForVendor === false) {

                    Kameleoon.API.Core.disableLegalConsent("AB_TESTING");

                    console.log("Disabling A/B Testing");

                }

            });

                                                

        Didomi.getObservableOnUserConsentStatusForVendor('c:kameleoon-personalization')

            .subscribe(function (consentStatusForVendor) {

                if (consentStatusForVendor === true) {

                   Kameleoon.API.Core.enableLegalConsent("PERSONALIZATION");

                   console.log("Enabling Personalization");

                } else if (consentStatusForVendor === false) {

                    Kameleoon.API.Core.disableLegalConsent("PERSONALIZATION");

                    console.log("Disabling Personalization");

                }

            });

                                                

    } else {

        Kameleoon.API.Core.enableLegalConsent();

    }

});
```

With this code, any time a visitor activates or disables Kameleoon's consent from the Didomi pop-in, Kameleoon receives a notification and activates or deactivates the Experiment or Personalization module (depending on whether the visitor grants consent).

Click **Save changes** to apply the changes to your configuration.

#### Consent policy

The last step is setting up your project's consent management policy to **Consent required** in both the **For A/B tests and feature experiments** and **For personalizations** sections. Read [this documentation](https://docs.kameleoon.com/user-manual/project-management/consent-management-policy.md) to find out more.

![The Consent tab with the three consent policy sections](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/manage-your-projects/consent-tab.png)

To set up the consent management policy on your project:

1. Click **Admin** > **Projects**, click **Edit** on your project's row, then click the **Consent** tab.
2. In each of the **For A/B tests and feature experiments** and **For personalizations** sections, click **Edit**, select **Consent required** in **Consent policy**, then click **Save changes**.

Kameleoon will now collect and store data based on the consent provided by the users from Didomi CMP.

## A/B test different version of your consent notice

With Kameleoon's integration with Didomi, you can run different versions of your consent notice by creating an experiment through Kameleoon.

Follow [these guidelines](https://docs.kameleoon.com/user-manual/project-management/consent-management-policy.md). You'll have to run a technical experiment. This experiment lets Kameleoon run the experiment before the visitor provides consent (which is necessary if you want to A/B test several versions of Kameleoon's consent pop-in).

Note that you can't analyze an experiment's results in Kameleoon's reporting tool as Kameleoon doesn't collect any data. However, Kameleoon will still send analytics data to your default analytics platform.

Below, you'll find an example of an experiment that A/B tests two versions of the consent notice: pop-in versus banner.

### Pop-in notice version

![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/integrations/as-a-source/cmp/didomi/Capture-décran-2021-05-10-à-17.04.29-1920x979.png)

![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/integrations/as-a-source/cmp/didomi/image4-1024x544-1.png)

### Banner notice version

![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/integrations/as-a-source/cmp/didomi/Capture-décran-2021-05-10-à-17.09.07-1920x976.png)

![](https://storage.googleapis.com/kameleoon-storage-documentation/user-manual/images/integrations/as-a-source/cmp/didomi/image7-1024x544-1.png)
