benjaminkott / bootstrap_package

Bootstrap Package delivers a full configured theme for TYPO3, based on the Bootstrap CSS Framework.
https://www.bootstrap-package.com/
MIT License
338 stars 205 forks source link

Cookie consent type "opt-in" and event dispatching #801

Open wtfred opened 4 years ago

wtfred commented 4 years ago

Hello,

In bootstrap.cookieconsent.js, on cookieConsent event onPopupOpen, you're dispatching the event bk2k.cookie.enable if type is "info" or "opt-out".

That is ok, because cookies should be enabled for those types of consent, as long as the user didn't express his consent.

But shouldn't you also dispatch the event bk2k.cookie.disable if type is "opt-in"? If i'm not mistaken, "opt-in" means cookies should be disabled as long as the user didn't express his consent. That will disable analytics tracking as long as the user didn't click to allow cookies, which is GDPR compliant.

Thanks for reading :)

gilbertsoft commented 4 years ago

Hi @wtfred

This event is already dispatched during init see https://github.com/benjaminkott/bootstrap_package/blob/master/Resources/Public/JavaScript/Src/bootstrap.cookieconsent.js#L128

Shouldn't that be sufficient?

And also the status change dispatches this event see https://github.com/benjaminkott/bootstrap_package/blob/master/Resources/Public/JavaScript/Src/bootstrap.cookieconsent.js#L141

wtfred commented 4 years ago

@gilbertsoft For me, it's not, because the "onInitialise" is only triggered when the user already made a choice to allow or refuse the cookies. So when a new user arrive for the first time, and didn't make a choice yet, no event is dispatched if type is "opt-in", so this user will got cookies.

gilbertsoft commented 4 years ago

k, that's strange. I would assume onInitialise is called before any other action. Will have a look at this...