Delete first-party browser cookies programmatically
Didomi has developed a script that your organization can utilize on-page to target and delete first-party browser cookies.This script ensures that previously accepted non-essential first-party cookies are no longer used after an end-user refusal of all purposes.
Identify essential cookies to preserve
The Didomi script allows your organization to specify any cookies you want to preserve so that they are not deleted when the script is executed. Any cookies not specified (as well as the items stored in localStorage) will be deleted.
When configuring the Didomi script your organization can directly name the cookies that should be preserved and/or use regular expression (regex) to preserve cookies that adhere to a specific pattern.
To preserve cookies that adhere to a specific text pattern, your organization can write a regular expression and assign to the itemsToKeepRegex variable:
var itemsToKeepRegex = /some_regex_[a-z0-9]*/;Implement Didomi programmatic first-party browser cookies deletion script
The script to delete first-party browser cookies can be found at the link below:
Didomi programmatic first-party browser cookies deletion script
The script works on all browsers and is triggered when an end-user who had previously agreed to all vendors and purposes subsequently changes their privacy choices to refuse all vendors and purposes. When the end-user withdraws their consent, the page will automatically reload and all of the cookies that have not been preserved in the script will be deleted from the browser.
Third-party trackers
Third-party trackers can only be removed by contacting the respective vendor(s) and request their assistance in the removal.
Your organization can use data from your Compliance Report to provide the vendor(s) 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.
Last updated