Expand my Community achievements bar.

Help shape the future of AI assistance by participating in this quick card sorting activity. Your input will help create a more effective system that better serves your needs and those of your colleagues.

Delete app Measurement cookies on consent change

Avatar

Level 5

Hi All,

 

I have the below requirement -

The user gives consent and accepts all cookie settings on the Cookie banner (Using OneTrust banner). App measurment cookies like s_cc, s_sq, s_ppn etc.. Now, user can change his consent anytime.

Once user resets his consent by choosing only essential cookies, the already created cookies needs to be deleted(some of these cookies are session cookie).

I know, I can delete cookies one-by-one in Adobe launch. I am looking for a any other and best possible solution.

 

Thanks for looking into my query! 

1 Reply

Avatar

Level 5

If you need to delete multiple cookies at once, you can use JavaScript to loop through an array of cookie names and delete them one by one. Here's an example function that you can use to delete multiple cookies:

function deleteCookies(cookieNames) {
for (var i = 0; i < cookieNames.length; i++) {
document.cookie = cookieNames[i] + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
}
}
This function takes an array of cookie names as a parameter, and then loops through the array, deleting each cookie using the document.cookie property.

To use this function, you can pass in an array of the cookie names that you want to delete, like this:

var cookiesToDelete = ['s_cc', 's_sq', 's_ppn'];
deleteCookies(cookiesToDelete);

You can call this function whenever the user changes their consent preferences and opts out of non-essential cookies. You can also modify this function to check the user's current consent settings before deleting any cookies, to ensure that you only delete cookies when necessary.

Note that if you're using Launch, you can also use the "Clear Cookie" action in the Adobe Analytics extension to delete cookies, instead of writing your own JavaScript function. However, this action only allows you to delete one cookie at a time, so it may not be the best solution for deleting multiple cookies.