How do I properly remove cookies after users opt-out of cookie consent?

0
8
Asked By SillyPanda99 On

I'm really frustrated with cookie consent regulations, but I've got to follow them. I'm using Termly to let users set their cookie preferences, and once they opt in or out of certain categories like marketing and analytics, I need to remove any cookies they opted out of. I've tried a couple of methods, including direct manipulation of document.cookie and using cookieStore.delete, but nothing seems to work. I even attempted to send a list of cookies to be purged on the server side, but that didn't help either. Can anyone give me some effective solutions for removing these cookies?

2 Answers

Answered By CookieNinja456 On

It sounds like the issue could be how browsers handle cookie deletions. Sometimes, cookies won't disappear right away and might only be removed when you close the tab. Additionally, if any cookies are marked as HTTP only, those can only be deleted from the server-side, so make sure you're using the right domain for that. One best practice is to get user consent before running any scripts that might set those cookies, and if they click to opt-out, you’ll need to ensure those scripts are disabled and the cookies removed too.

SillyPanda99 -

Thanks for the information! That makes a lot of sense and clarifies some things.

Answered By TechWhiz123 On

Actually, cookie consent rules say that users shouldn't have any cookies they didn't agree to. If they're opting out, you really do need to remove those cookies. Your first method should typically work, so it might be an issue specific to your implementation. What happens when you try to delete them? Are there any error messages or is it just that they remain? That might give us a clue as to what's going wrong.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.