Hi @JFeltkamp,

Great module, thanks!

I'm working with a client that wants to set some services groups to default to 'allow' (green / consent given) and some to 'deined' (consent not given) whlile still allowing the user to toggle the options on each service group.

As far as I can see, this is not an option at present, is that correct?

All services groups where consent is required default to decline. I can't see any option to set this in the cookiesjsr library either https://github.com/jfeltkamp/cookiesjsr so perhaps this is by design.

I was then interested to expore forking the code and note that the source is not available yet on reading this issue: https://github.com/jfeltkamp/cookiesjsr/issues/6

Could you just confirm my understanding is correct? If so, is there any way we can extend the options to allow setting the default values for each service group?

Many thanks,

Finn

Comments

Finn Lewis created an issue. See original summary.

anybody’s picture

Version: 1.0.17 » 1.0.x-dev
jfeltkamp’s picture

Status: Active » Postponed

Hello @Mr. Lewis,

sorry, I'm late with my answer. But may be it will help someone else.
You know this is a queer request, but it is your responsibillity that all is in terms of the GDPR.

My recommended solution

This is the core of a javascript you will need. It will set the services "my_service" and "xy_service" to "allow".
(You can execute the code from every JS file you want. You don't need a fork or somthing. Just create a custom Drupal css/js library with a dependency: "cookies/cookiesjsr". This ensures the event listener is present.)

var services = {
  'my_service': true,
  'xy_service': true,
}
document.dispatchEvent(
   new CustomEvent('cookiesjsrSetService', {detail: { services }})
);

WARNING: Just set services, you want to enable. The other services are denied by default. Because: If you set all existing services, the COOKiES consent banner will not come up.

This code has to be wrapped into other code that ensures that this function is only executed once at the beginning of the session and not for every page view.
I would recommend to check, if the cookie with the name cookiesjsr IS_NOT present THEN execute code above.
(To check if the cookie "cookiesjsr" exists, you can use e.g. the JS/CSS library "core/js-cookie" as an other dependency.)

// Don't know if this is correct. 
if(typeof cookies.get("cookiesjsr") !== 'object') {
   // code above here.
}

All in all just 10 lines of code and you are done.

anybody’s picture

Version: 1.0.x-dev » 1.1.x-dev
Category: Support request » Feature request
Priority: Normal » Minor
Parent issue: » #3323044: [2.x] Use the Cookies service "Consent required" value and add tests
anybody’s picture

Title: Set the default preference to 'allow' or 'deny' for each service » [2.x] Set the default preference to 'allow' or 'deny' for each service
anybody’s picture

Title: [2.x] Set the default preference to 'allow' or 'deny' for each service » [PP-2.x] Set the default preference to 'allow' or 'deny' for each service
anybody’s picture

Title: [PP-2.x] Set the default preference to 'allow' or 'deny' for each service » [2.x] Set the default preference to 'allow' or 'deny' for each service
Version: 1.1.x-dev » 2.x-dev

Hey ho, let's go! 2.x branch was recently created. Please help to implement this or if you're not a developer, please sponsor some development hours.

anybody’s picture

Status: Postponed » Active
avpaderno’s picture

Positive discourse message

This discussion appears to include escalating emotions, creating the opportunity for miscommunication. The invested parties are encouraged to take a break from this discussion to help gain perspective. It is important to the community that all members are shown the appropriate amount of respect and openness when working together.

For more information, please refer to Drupal’s Values and Principles of seeking first to understand, then to be understood. Assume best intentions of other contributors and suspend judgment until you have invested time to understand decisions, ask questions, and listen. Before expressing a disagreement, make a serious attempt to understand the reasons behind the decision.

This comment is provided as a service (currently being tested) of the Drupal Community Health Team as part of a project to encourage all participants to engage in positive discourse. For more information, please visit CWG - Community Health team - "Nudge" templates.

orcalator’s picture

I'm really now putting effort to see what is going on here. So this module "COOKiES Consent Management" (https://www.drupal.org/project/cookies) is under "GNU General Public License, version 2". Now, my question is, why this module includes JS code that has been minifed and is not easily human-readable? This is in violation of GNU General Public License, version 2. Also, mr. @anybody mentions sponsoring of development of the module in one of the previous posts. So, we have closed (non-human readable JS code) that is crucial for this module to work and we have sponsoring ideas. Blink blink?

anybody’s picture

@orcalator I have no idea which personal problems you have, but let me tell you why this escalated.

This is a community project and all the maintainers put in weeks of their spare time. You came here, not trying to help with any kind of fix, like a patch or MR, just being unfriendly and offensive. Why are you wondering about such reactions?

You're still not trying to help in any positive way. It's very simple: Help yourself and the community by debugging this issue and providing helpful information to fix it. You would have immediately got help and assistance, if you did that.

Still no idea why. And no, I'm sorry to tell you that this is not a violation of GNU, the included library in 2.x is also under GNU: https://github.com/jfeltkamp/cookiesjsr and written by the original maintainer of COOKiES. It's just minified as best practice for faster loading.

You should ask yourself, why you're so frustrated and putting that much power into negativity. I'm honestly sorry for that.
And I should ask myself why I'm still taking the time to reply to such trolling comments.

anybody’s picture

PS: Nobody here earned a cent with this, just to let you know ;)

anybody’s picture

PPS: Just calm down and try to help to improve things. That would be great! (Power of positivity!)

avpaderno’s picture

The GNU General Public License says the source code must be available, not that code cannot be minified.
This is not even the case, since the source code is available on https://github.com/jfeltkamp/cookiesjsr.

anybody’s picture

Thanks @avpaderno and it's not even included, but an external library.

avpaderno’s picture

Title: [2.x] Set the default preference to 'allow' or 'deny' for each service » Set the default preference to 'allow' or 'deny' for each service