Cookie consent with Opt-In/ Opt-Out

The following describes how we can implement a GDPR compliant cookie consent with the possibility of cookie user opt-in / user opt-out.

The Blocs project attached is meant to visualize the selected functionality and gives simple explanations what’s going on :wink:

Below the main screen (with consent given) is shown:

Consent logic - how does it work?

  1. Whenever the page loads, the 'displayConsentAndAllowance‘ interaction is run. This interaction modifies the text on the screen to reflect the current settings.

  2. If the consent has not been given within the last 24 hours the consent modal will show up and ask the user for opting.

  3. Clicking 'Revoke consent‘ will destroy all cookies and after the next page load the user is asked to allow or disallow cookies. The consent is given implicitly when the user opts-in or opts-out. The validity of the consent cookie is 1 day, this meaning, if the user will return to/ reload this web page within 24 hours he will not be presented with the dialog.

  4. The 'Cookies opt-in/opt-out‘ button lets the user change his mind… This can be tested with the…

  5. 'Try to set analysis cookie‘ button. This button sets a cookie only, when the user has opted-in. A dialog will show the result of the try.

Custom Interactions needed

The following interactions are used for this implementation:

displayConsentAndAllowance:

resetConsent:

allowCookies:

disallowCookies:

tryAnalysisCookie

…and here is the project
CookieConsent_CustInteract.bloc (89.7 KB)

Feel free to comment, improve and use it in your projects.

Regards
TomS

17 Likes

This is awesome and many thanks for sharing.

1 Like

Thanks :slight_smile:
A lot of edits, but now it’s finished :wink:

Have fun,

Regards
TomS

3 Likes

Sorry, @Norm
I did not notice that the Lab here is not meant for user submitted interaction constructs. Would you please be so kind to move my thread to a more appropriate location (maybe ‘Tips and Tricks’)?

Thanks and
Kind Regards
TomS

This is amazing :exploding_head:

2 Likes

No the interaction lab is for everyone. Thanks for sharing this. My aim is to inspire everyone to build and share these here in the lab :+1:

2 Likes

And now it’s your turn @Norm :grin:
It would be great if we could export a bloc that contains custom interactions with these actions to the bloc library. For use in another project.

6 Likes

It would be great to have something like this in a bric, so we can add it easily to a website!

7 Likes

Thanks @Norm :slight_smile:

However, during the development of this I was missing an If - Else - End If

Maybe the ‘Else’ could find its way to the feature list of an upcoming Blocs release?

Thanks for this incredible piece of software.

Best Regards
TomS

You can use stop interaction when an if statement is met. If you put your else rules behind the stop, it’s a kind of primitive if /else.

I’ve used this in a few of my examples.

1 Like

Awesome work, thanks for sharing!

1 Like

This is only applicable if we use cookies on our Blocs site, correct? If we don’t create any cookies, whether for logins or anything else (in other words, a simple Blocs site with no added scripts), we don’t have to worry about any cookie consents since there are no cookies, correct?

Or does Blocs function with cookies even if we don’t add them?

Correct.

If you want to include maps or videos, check out

3 Likes

Thanks, Jannis! I will keep this in mind if/as I expand beyond the simple.

1 Like