Skip to main content

OneTrust for Custom Consent States

Written by Luiza Gircoveanu

Overview

Compliance with data privacy regulations requires careful testing of user consent preferences.

In ObservePoint, you can test OneTrust consent preferences in Journeys and Audits by using the Automated Consent Manager State Action type. This can accept and decline all cookies. However, other consent states require using the OneTrust Javascript functions.

Instructions to set Custom Consent States

1. Configure the OneTrust API for Custom Consent States

Prepare a JavaScript snippet to update the user consent preferences using OneTrust.UpdateConsent.

Here are some example snippets that can be used or you can write new snippets based on your needs:

OneTrust.UpdateConsent("Category","C0003:1"); 
//Enables consent for functional cookies

OneTrust.UpdateConsent("Category","C0001:1,C0002:1,C0003:0");
//Enable consent for Strictly Necessary and Performance Cookies but deny consent for Functional Cookies

OneTrust.UpdateConsent("Category","C0001:1,C0003:1); 
//Enable consent for Strictly Necessary Cookies and for Functional Cookies

OneTrust.UpdateConsent("Category","C0002:0,C0003:0,C0004:0);
//Disable consent for Performance Cookies, Functional Cookies, Targeting Cookies

Each category is associated with a certain type of cookie and the JavaScript snippet has to be tailored according to your use cases:

Category name

Meaning

C0001

Strictly Necessary Cookies

C0002

Performance Cookies

C0003

Functional Cookies

C0004

Targeting Cookies

C0005

Social Media Cookies

C000X

Custom Category

Check the official OneTrust documentation here.

2. Access the Desired Journey or Audit in ObservePoint

  • Open the Journey or Audit where you want to test non-automated consent states

  • Navigate to the Pre-Audit Actions (for Audits)/ Actions (for Journeys) and create a "Clear all cookies" action and then a "Execute Javascript" and paste the OneTrust.UpdateConsent JavaScript snippet you need.

Audits

Journeys

3. Test the new setup: Run the Journey or Audit to confirm that the custom action successfully sets the desired consent states. Within the Audit overview, you can see the OneTrust tags in the Tag Inventory report.

Conclusion

Setting Custom Consent States into ObservePoint Journeys and Audits through custom actions is a powerful way to validate compliance with privacy laws.

By using the OneTrust.UpdateConsent method, you can replicate real-world scenarios where user preferences are set programmatically or manually.

Did this answer your question?