7οΈβ£Setting up consent management
To enable consent management in the Cookie3 Analytics snippet, ensure your script configuration in the tag includes this line: consent-required="true"
Handling Consent Management with the window.cookie3
Object
window.cookie3
ObjectWhen handling consent management on your website using the window.cookie3
object, you have access to several methods that allow you to give users control over their tracking and cookie consent decisions. Here's how you can use these methods to implement consent management.
Let Users Express Consent
To let users express their consent for tracking and cookie usage, you can use the following method from window.cookie3
. Call the setTrackingConsentGiven()
method when the user agrees to tracking:
Check if User Consented to Data Processing
Before processing any data, it's essential to check if the user has already given their consent. You can check this using the isTrackingConsentGiven()
method:
Check if User Declined Data Processing
If the user has explicitly declined tracking or cookie usage, you can detect this by checking the value returned by the isTrackingConsentGiven()
method.
If the method returns false
, it means the user has not consented to tracking (or has declined):
Remember User's Decline Decision Using Local Storage
When the user declines consent, you can remember their decision by using the forgetTrackingConsentGiven()
method. This method store the user's decline decision in local storage, ensuring their preference is remembered across sessions:
By storing these decisions, the user's choice will be remembered and you won't need to ask for consent again unless the user clears their browser's local storage.
Summary of Methods:
Give consent:
window.cookie3.setTrackingConsentGiven()
Check consent:
window.cookie3.isTrackingConsentGiven()
Decline consent:
window.cookie3.forgetTrackingConsentGiven()
This consent management flow helps you comply with privacy regulations by giving users full control over how their data is handled, while remembering their preferences for future visits.
Last updated