Open kratos-digital opened 7 months ago
I'll second that. Especially as it is part of being GDPR-compliant (which is stated in the Readme). A simple true/false value representing the consent given attached to the custom event (like on:analytics
) should suffice to easily run opt-out functions to revoke cookies.
An even neater solution would just notify on choice changes. When backwards-compatibility should be kept, a different custom event should better be dispatched, e.g. on:analytics-opt-out
, so that all the opt-in code can be left untouched. Let me know if that solution is acceptable and I will create a PR.
I would appreciate this change very much!
Here is a simple proposal (I also changed the cookie settings close button to submit the changes directly): commit
The way this is GDPR compliant is that you don't run any sort of non-gdpr compliant code until the user consents to those types of code, by clicking Accept. If they Reject or ignore, then you don't do anything.
That being said I'm not averse to events being run when the choices change. Feel free to open a PR and I will review.
Ok, I will create PR as soon as I can
Is there a way to dispatch an event when user clicks Reject button or Accept button when choice is inactive? For example, user comes to website and clicks Accept. To make it simple we only have analytics. It will dispatch an event and using
on:analytics={myCustomFunction}
we can handle our analytics.If user decides that he/she wants to revoke consent, but clicking Reject button, nothing happens. Also nothing happens if user clicks Accept when analytics is unchecked under settings. User should be able to revoke/remove cookies via cookie consent element. Yes, they can always clear cookies in browser, but most users aren't tech savvy and I think it's part of GDPR to enable user to revoke its consent.