Funciones
Aprovecha las funciones avanzadas e integra CookiePal con otras herramientas.
guides.manage-cookies-link.title
guides.manage-cookies-link.description
Table of contents
back
to the top
Add a "Manage cookies" link or button to your site so visitors can change their mind and revoke a previously-granted consent at any time. CookiePal handles the server-side revocation, the cookie cleanup, and the banner re-display — you only need to add a single HTML attribute.
Add the data-cookiepal-reopen attribute
1. Add a link or button somewhere persistent on your site (typically the footer):
<a href="#" data-cookiepal-reopen>Manage cookies</a>
2. The CookiePal banner script automatically detects any element carrying the data-cookiepal-reopen attribute and wires a click listener to it.
3. When the visitor clicks it, the script revokes their current consent server-side, clears non-necessary cookies, and re-opens the banner so the visitor can submit fresh choices.
1<a href="#" data-cookiepal-reopen>Manage cookies</a>How the revocation flow works
When a visitor clicks the link, CookiePal performs four steps:
1. Calls our revocation API (POST /consent/{consentId}/revoke) with the visitor's consent ID and the reason user_request.
2. Clears every non-necessary cookie that your category configuration declares.
3. Wipes the cookiepal-consent and euconsent cookies on the root domain so the banner state machine returns to "no action recorded".
4. Tears down the current banner UI and re-renders it for a fresh prompt.
The flow is idempotent: clicking the link a second time on a record that's already revoked is treated as success.
Trigger revocation from your own JavaScript
If you cannot use the attribute (for example, if you render the link inside a Shadow DOM that the banner observer can't reach), call the API directly from your own JavaScript:
1window.cookiepal.api.reopenAndRevoke();The function returns a Promise you can await. Listen for the cookiepal_consent_revoked custom event on window if you want to react in your own analytics layer.
1window.addEventListener('cookiepal_consent_revoked', () => {
2 // your app-level cleanup here
3});What cookies get cleared
CookiePal clears the cookies it knows about — every cookie declared under a non-necessary category in your Cookie Categories settings, plus the cookiepal-consent and euconsent state cookies.
Cookies set by your own application that are NOT declared in CookiePal categories will NOT be cleared. If your application stores user-tracking data (e.g. in localStorage or an app-managed cookie), clear that yourself inside the cookiepal_consent_revoked event listener shown above.