Alex-D / Cookies-EU-banner

1kb vanilla JS script which manages cookies consent banner display like asked by GDPR
http://alex-d.github.io/Cookies-EU-banner/
MIT License
441 stars 57 forks source link

Option to allow user to revoke consent #43

Closed NewJenk closed 5 years ago

NewJenk commented 5 years ago

Hello,

Great work on the plugin.

Would it be possible to add an option to allow users to revoke consent for cookies after they've already agreed to them? For example, clicking a link on the page with a specific class/id would delete the cookies and re-instate the banner?

Alex-D commented 5 years ago

It should be simple :)

Perhaps, it seems you just need to add call to Cookies EU banner in your code like this:

var ceb = new CookiesEuBanner(function(){
    // Your code to launch when user accept cookies
});

// Then you can remove the cookie
ceb.removeCookie(ceb.cookieName);
// And call the showBanner manually
ceb.showBanner();

Should I add a listener with a specific ID which do that without custom code on your side?

If yes, feel free to tip me here if you can: https://paypal.me/alexandredemode/20eur

NewJenk commented 5 years ago

That's brilliant - thanks @Alex-D. I had to use deleteCookie instead of removeCookie but seems to be working other than that.

Thanks again.