EU Cookie Compliance module ables you to set cookie lifetime to 0, invalidating the cookie at the end of the browser session.
But this feature shows the Cookies banner always, despite if you Agree or Disagree with the terms.
It could be very usefull to set cookie lifetime to 0 only if a user Disagree, in order to show the cookie banner every new session until the user Agree. This solution should be GDPR compliant, but in the same time should push user to enable cookies (es. Analytics), with the quite annoying reminder.

Comments

davidebarbato created an issue. See original summary.

davidebarbato’s picture

This seems to work, modifying in eu_cookie_compliance.js:

Drupal.eu_cookie_compliance.declineAction = function () {
+Drupal.settings.eu_cookie_compliance.cookie_session=1;
Drupal.eu_cookie_compliance.setStatus(0);

...

svenryen’s picture

Thanks. I see what you want and it makes sense, in fact more sense than the current implementation.

Unfortunately we can't change a feature that's already in the module, since there's at least one person using it (the person who contributed the patch).

So we need a patch for this, both for D7 and D8. The feature will require a new checkbox on the admin page, and some modifications to the JS. Any chance you're able to help write the patch?

davidebarbato’s picture

Hi svenryen,
Ok, I'll think about how to add this feature with a patch.
I have to figure out how to include a new checkbox not in contrast with the "Prompt for consent at every new browser session" and its code. Could be something like: "Prompt for consent at every new browser session ONLY if not already agreed" with new variable, ex. [disagree_set_cookie_session], to check before setting cookie_session=1 on click declineAction in JS.

davidebarbato’s picture

Hi svenryen,
As asked I added the feature with a patch, starting from the D7 version.
I added the same logic if a user clicks the "Decline or the ""Withdraw consent" button.

This patch could also be used to addresses this issue:
https://www.drupal.org/project/eu_cookie_compliance/issues/3013123

Next days I'll work to the D8 porting.

davidebarbato’s picture

svenryen’s picture

Status: Active » Needs review
jlbellido’s picture

Version: 7.x-1.25 » 8.x-1.x-dev
Status: Needs review » Needs work

I've checked the latest patch and it worked for me. However we need to review the coding standars.

jlbellido’s picture

I'm just uploading a new version with the coding standards fixed. Probably we would need tests for this new feature right?

Thanks!

jlbellido’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
jlbellido’s picture

My apologies for the noise, but this is the correct patch.

Status: Needs review » Needs work
svenryen’s picture

Status: Needs work » Needs review
anybody’s picture

Thank you very much @jilbelido, great idea!

I just reviewed your patch and guess "disagree_set_cookie_session" is not a perfect name for that feature. What you want might be like "disagree_clear_cookie_session" or "set_cookie_session_zero_on_disagree"?

Furthermore I think it would be much better to use a select or radio buttons instead of an additional checkbox, which would be confusing, I guess.

But yes, I definitely like the idea, especially from the marketing perspective!

svenryen’s picture

  • svenryen authored f1dbdc3 on 8.x-1.x
    Issue #3016973 by jlbellido, davidebarbato, svenryen, Anybody: Show...
svenryen’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.