OneTrust
Detailed technical documentation on integrating the OneTrust consent management platform with RudderStack.
Last updated
Was this helpful?
Detailed technical documentation on integrating the OneTrust consent management platform with RudderStack.
Last updated
Was this helpful?
is a popular platform that provides data governance, privacy management, and security solutions to thousands of businesses around the world. Its consent management solutions are used by many digital marketing and engineering teams for implementing cookie compliance and consent management on various martech systems.
The JavaScript SDK integrates seamlessly with the OneTrust SDK and lets you map OneTrust cookie/consent groups to RudderStack's consent purposes. RudderStack, in turn, uses this consent information to enable/disable tracking and sending the data.
The OneTrust integration with the JavaScript SDK is applicable only for the connections.
Whenever a user starts browsing a website, OneTrust pops up a modal to take consent from that user. This modal contains a list of cookie groups representing the GDPR consent purposes that the user has declined or consented to.
The JavaScript SDK fetches these consented groups as well as the destination - OneTrust category mappings specified in the RudderStack dashboard. Depending on these settings, the SDK will filter the destinations.
The following sections highlight the steps required to set up the JavaScript SDK integration with OneTrust.
Follow these steps to configure OneTrust for your web app:
Create a OneTrust account. Make sure it has access to the Cookie Compliance app.
Then, add your website and scan it.
Next, go to the Categorizations section. Here, define the new categories or modify the existing ones, as per your requirement.
The categories should be associated with/attached to at least one cookie for them to be displayed in the OneTrust modal on your web app. You can use one of the RudderStack cookies as a workaround.
Finally, go to the Scripts section and publish this script.
This step involves enabling OneTrust for a given JavaScript source. To do so, specify the consent category names as defined in OneTrust (Step 1) for each destination that is connected to that JavaScript source.
Important: Load the JavaScript SDK only after the user provides the consent.
One way to load the JavaScript SDK after the user provides the consent is to modify the OptanonWrapper()
callback function provided by OneTrust, as shown:
If the consent is updated, you need to refresh the page to load the SDK.
Then, add the cookieConsentManager
option in the load()
call as shown in the following snippet:
Once you complete these steps, RudderStack reads the consented categories and filters the destinations accordingly.
Before following the steps in this section, load the OneTrust script that you published in your web app in . A sample script is shown below:
For queries on any of the sections covered in this guide, you can or start a conversation in our community.