Pop up help

I want to do something so that if you accept the 'Accept Cookies' button, then the popup won't show up again if you refresh the page. But if you reject it, then it will keep appearing. I think I have to use local storage for that. How can I do so? https://codepen.io/saad-shehzad-the-bashful/pen/YPzyLmJ
6 Replies
b1mind
b1mind3d ago
Use a cookie? 🍪
Jochem
Jochem3d ago
(I know b1's is a half-joke answer, but "reject cookies" means "reject tracking cookies". I'm 99% sure you're still allowed to use some functional cookies, as long as they can't be (and aren't) used to track the individual on your site or across sites. You can totally have a show_cookie_popup cookie set to 0) in fact, I'm pretty sure that if you have zero tracking cookies on the site, but only have functional ones (which has a set definition in the GDPR), you don't even have to show the popup. but IANAL
vince
vince3d ago
You can also use local storage right? To store preferences of ui state
Jochem
Jochem3d ago
I think "cookies" is a non-technical term when used in context of the GDPR. Pretty sure you can't just shift your tracking stuff to LocalStorage just cause it's not technically a cookie so yeah, you can totally use local storage too
Jochem
Jochem3d ago
MDN Web Docs
Window: localStorage property - Web APIs | MDN
The localStorage read-only property of the window interface allows you to access a Storage object for the Document's origin; the stored data is saved across browser sessions.
vince
vince3d ago
Ye just meant if you reject cookies you hide that preference in the local storage, else enable cookies actually sets the cookies But maybe it's better to just keep the preference as a cookie like you were suggesting since it's probably more semantic (and how most cookie consent pop-ups work anyway iirc, just wanted to propose an alternative)

Did you find this page helpful?