I’m trying to build a proper cookie consent system.
Just wondering — what is the right way to do it without plugins.
I’m trying to build a proper cookie consent system.
Just wondering — what is the right way to do it without plugins.
Happy for advice
Which part of it do you need help with?
The visual/UX?
Or the actual functionality? (i.e. using it to determine whether or not to use cookies)?
And what (non-essential) cookies is your app currently using?
Thanks! I’m mostly interested in the functionality.
I use Google Analytics, but nothing else beyond Bubble’s defaults.
So here’s my question:
When a logged-out user clicks “Accept” on the cookie popup (a floating group), and I run the “Opt-in to cookies” action —
where is that choice saved?
Is it saved in the browser somehow? Or will the popup show up every time they visit unless they’re logged in?
You need to store the response in a cookie on the User’s browser..
For a very basic implementation it can just be a boolean value..
But more usually you’ll want to store a small JSON string, with info about which ‘type’ of cookies they’ve consented to, and timestamps etc.
Then, on page load you’ll need to read that cookie, and if (and only if) they have consented to allow nonessential cookies then you can enable Cookes of those consented types to be set (note: for non-bubble Cookes, like GA you’ll need to do that manually - the ‘opt-into cookies’ action only applies to non-essential Bubble cookies).
If the cookie consent (for a given type) has not been given then, obviously, make sure NOT to set any cookies of that type.
And if no response has been given at all then show the Cookie Consent UX and then store the response in the cookie.