Reset your visitors' consent

Loïc
Loïc
  • Updated

Like Neo, you want to start again from zero ?

You can reset the consent of your visitors in order to request their consent on their next visit. This can be useful if you have modified your widget and want to present the new version to all your visitors.

To do so, you will have to add a piece of code in your Axeptio script:

constdeleteAxeptioCookie = () => { 
constcookies = document.cookie.split("; ");
for (constcookieofcookies) {
consteqPos = cookie.indexOf("=");
constname = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
if(name === "axeptio_cookies"){
document.cookie = name + "=; Path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT";
}
}
}
window._axcb = window._axcb || [];
window._axcb.push(function(sdk){
sdk.on('cookies:complete',function(choices){
constconsentDate = newDate(choices.$$date);
constdesiredDate = newDate('2021-12-17T14:30:30.499Z'); //Change the date to your new desired date
if(consentDate < desiredDate){
deleteAxeptioCookie();
window.location.reload();
}
})
})

This script will have the effect of deleting the consent stored in the visitor's browser, if it is older than the value "desiredDate", which you can change as you wish.

Was this article helpful?

5 out of 9 found this helpful