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.
Note: The details described below only apply to first-party cookies. Technically, it is not possible to delete third-party cookies that have already been dropped on an end-user's browser if the end-user refuses all purposes later.
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.
Note: Didomi strongly recommends that you include the following Didomi cookies in your list of preserved cookies:
didomi_dcs- The Didomi Consent String (DCS) is a binary format that replaced didomi_token and offers a smaller, more compact representation of user consent data.didomi_token- A legacy cookie that contains consent information for custom purposes and vendors, as well as Didomi-specific information.euconsent-v2- Contains the IAB TCF consent string and consent information for all the standard IAB vendors and purposes.
Preserving these cookies will keep your consent notice from reappearing to re-collect the end-user's consent.
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.
If your organization knows the name of cookies you wish to preserve include those in the itemsToKeep array:
var itemsToKeep = ["euconsent-v2", "didomi_token", "didomi_dcs"]; 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 Didomi provided script is a template that may not directly be applicable to your organization's specific use case and may require adaptation on your behalf to work as intended.
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.
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.
Last updated