PRA/DSAR - Web CMP Opt Out
Overview
If you would like to opt out of specific Web CMP purposes after a user submits a PRA/DSAR form on your website, the following solution can be used.
PRA/DSAR
Your web form must be an iFrame/embedded web form on the page. This allows us to post an event on click of the submit button on the form. To locate your iFrame script, head to Privacy Rights Automation > Setup > Web Forms > Your Form > Integrate.

In the same section under Settings, enable the Post an Event on Click of Submit Button toggle and add your target window URL.

See more information regarding the PRA Form Submission Event here.
Web CMP
IMPORTANT
The Web CMP script must be present on the same page as the embedded PRA/DSAR form.
After the setup steps above, you can utilize the form submission event to programmatically trigger an opt out in the Web CMP.
PRA/DSAR form event
window.addEventListener("message", function(event) {
if (event.origin != 'https://webformurl.com') {
// something from an unknown domain, ignore
return;
}
alert( "received msg from parent: " + event.data);
});
As PRA/DSAR forms may have different request types such as Access Requests, Data Deletion Requests, Do Not Sell My Personal Information Requests, etc, you may only want to opt the user out of the Web CMP when certain request types are submitted. In this case, you can use the requestTypes
data returned as part of the form submission event for your logic gate. You can view code references of this usage below.
Option 1: Reject All
Opts out of all non Strictly Necessary categories in the CMP
OneTrust.RejectAll()
//Reject All when form is submitted regardless of request type
window.addEventListener("message", function(event) {
OneTrust.RejectAll();
});
//Reject All when form is submitted with certain request types
window.addEventListener("message", function(event) {
try {
const eventData = JSON.parse(event.data);
const requestType = eventData.requestTypes;
if (requestType.includes("Data Deletion")) {
console.log("Request type is Data Deletion. Opting out of consent in Web CMP");
OneTrust.RejectAll();
} else if (requestType.includes("Do Not Sell My Information")) {
console.log("Request type is Do Not Sell My Information. Opting out of consent in Web CMP");
OneTrust.RejectAll();
}
} catch (error) {
console.error('Error parsing event data:', error);
}
});
Option 2: Update Consent By Category
Opts in/out of specific categories in the CMP
OneTrust.UpdateConsent(groupIdType, bitValue)
//Opt out of specific categories when form is submitted regardless of request type
window.addEventListener("message", function(event) {
OneTrust.UpdateConsent("Category","C0004:0");
});
//Opt ouf of specific categories when form is submitted with certain request types
window.addEventListener("message", function(event) {
try {
const eventData = JSON.parse(event.data);
const requestType = eventData.requestTypes;
if (requestType.includes("Data Deletion")) {
console.log("Request type is Data Deletion. Opting out of consent in Web CMP");
OneTrust.UpdateConsent("Category","C0004:0");
} else if (requestType.includes("Do Not Sell My Information")) {
console.log("Request type is Do Not Sell My Information. Opting out of consent in Web CMP");
OneTrust.UpdateConsent("Category","C0004:0");
}
} catch (error) {
console.error('Error parsing event data:', error);
}
});
You can see a full list of available Cookies CMP public methods here.
Updated 6 days ago