To ensure that previously accepted non-essential first-party cookies are no longer used following a refusal, you might choose to delete these cookies programmatically. This guide will explain how to do this.
The steps described here focus on removing cookies associated with the main domain and subdomains of the page in question.
⚠️ This method only applies to first-party cookies. It is not technically possible to delete third-party cookies that have been dropped on the user's browser after being previously accepted.
The removal of first-party cookies from the browser can be done thanks to a script that you can integrate in your website.
In order to set this configuration, follow these steps:
Identify the essential cookies
You have to identify the names of the necessary cookies that you want to keep on the user's browser. You will have to specify these cookies in the script in order not to delete them. The rest of the cookies, as well as the items stored in the localStorage, will be deleted by default.
⚠️ Do not delete Didomi's cookies (didomi_token and euconsent-v2).
This would mean that the consent notice would be displayed again to recollect consent.
Insert the script to delete the cookies
Follow the link below to access the script to insert:
https://github.com/didomi/samples/tree/main/how-to-delete-browser-cookies
This is not a universal recipe that can be applicable the same way in all cases. The script is a standard code that will potentially need to be adapted depending on the configuration and limitations of your particular case.
The script works on all browsers. It is triggered when a user who had previously agreed to everything changes their choices to refuse everything. In this sense, when a user withdraws their consent, the page will be automatically reloaded and all the cookies that have not been specified in the script will be deleted from the browser.
What about third-party trackers?
The only way to remove third-party trackers is to contact the respective vendors and request their assistance.
Use data from your Compliance Report to provide the vendor with a detailed list of the third-party trackers detected on your website. Include the following information:
- Tracker name
- Tracker domain
- Tracker type (e.g., cookie, pixel, etc.)
- Third-party vendor responsible
Sharing this information ensures vendors can take appropriate action efficiently.
If the trackers are integrated via embedded content, such as videos or podcasts, consider removing the embedded content from your website to eliminate the trackers directly.