Skip to main content

OneTrust

OneTrust is a platform that focuses privacy and security & governance. Customers use OneTrust to build integrated programs that comply with the CCPA, GDPR, LGPD, PDPA, ISO27001, and hundreds of the world's privacy and security laws.

This guide walks you through how to set up an integration with OneTrust CMP.

Integration with OneTrust CMP

Kameleoon provides a custom integration with OneTrust CMP. Kameleoon automatically reads the consent policy within the OneTrust platform for both our experimentation and personalization modules.

Enable OneTrust integration on Kameleoon

First, you must add Kameleoon in OneTrust's CMP.

Configure OneTrust in Kameleoon

caution

The Kameleoon snippet needs to be triggered independently of OneTrust and added directly to the page's source code to prevent flickering in your experiments and personalizations.

  1. Log in to your Kameleoon account.
  2. Click Admin > Projects.
  3. Click Configuration on your project's card.

  1. Unfold the General section.

Global custom script

The Global custom script insert links Kameleoon to OneTrust. Any JavaScript code you add in this insert will be executed every time the page is loaded. This feature is often used to add complex tracking code or integrations to other solutions.

To activate the bridge between Kameleoon and OneTrust, copy and paste the code below into the Global script section:

Kameleoon.API.Core.runWhenConditionTrue(
() => window.OneTrust && window.OneTrust.OnConsentChanged && window.OnetrustActiveGroups,
() => {
Kameleoon.API.Visitor.personalizationLegalConsent || -1 === window.OnetrustActiveGroups.indexOf("**C0003**") || (console.log("[KAMELEOON ENABLE CONSENT] basic state"), Kameleoon.API.Core.enableLegalConsent("BOTH")),
window.OneTrust.OnConsentChanged(({ detail: e }) => {
e &&
(e.includes("**C0003**")
? (console.log("[KAMELEOON ENABLE CONSENT] consent changed"), Kameleoon.API.Core.enableLegalConsent("BOTH"))
: (console.log("[KAMELEOON DISABLE CONSENT] consent changed"), Kameleoon.API.Core.disableLegalConsent("BOTH")));
});
}
);

You will need to update the code above depending on the category where Kameleoon has been added in Onetrust. For example, you may have a group called "Performance Cookies," which has a category id of C0002.

With this code, any time a visitor activates or disables Kameleoon's consent from the OneTrust pop-in, Kameleoon is automatically notified, and will activate or deactivate the Experiment or Personalization module (depending on whether the consent is granted or not).

Click Validate to apply the changes to your configuration.

The last step is setting your project's consent management policy to Consent required for both Experiment and Personalization. Please read this documentation to find out more.

To do this:

  1. Unfold the Experiment and/or Personalization section of your configuration.
  2. Select the Consent required option in the dropdown.
  3. Click Validate to apply your changes

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