gdpr-cookie-consent-banner
gdpr-cookie-consent-banner copied to clipboard
Adding callback/dispatcher to confirm or return dispatch for unticked options
I was in need of a custom callback on confirm which would remove additional cookies as soon as some of the options were not ticked. So I thought a custom callback on confirm would be nice. Could we alter the choose
function to something like this?
function choose () {
setCookie(cookieChoices)
execute(cookieChoices)
dispatch('confirm', {
cookieChoices
})
}
I can do a PR if necessary.
By the way since we offer the ability for users to opt back in we should consider adding a custom dispatch event even if the selection has been set to false. Let's say I want to remove additional cookies as soon as I confirm I no longer wish to allow google analytics - it's painfully hard to enable/disable analytics as it is. So I've injected the analytics script as soon as on:analaytics
was fired, but then again as soon as I summon the cookie prompt and set analytics to false there's no way for me to tell to either reload the page or remove all cookies and scripts associated with it. Hope that makes sense @antony.
TL;DR: either enable a callback on confirm which would return the currently selected cookie states (a simple true/false for each of them) or dispatch events for each selection no matter if the choice was true or false.
Hi Mario,
Sounds good to me - I'd welcome a PR
On Thu, 5 Dec 2019 at 12:22, Mario Jankovic [email protected] wrote:
I was in need of a custom callback on confirm which would remove additional cookies as soon as some of the options were not ticked. So I thought a custom callback on confirm would be nice. Could we alter the choose function to something like this?
function choose () { setCookie(cookieChoices) execute(cookieChoices) dispatch('confirm', { cookieChoices }) }
I can do a PR if necessary. By the way since we offer the ability for users to opt back in we should consider adding a custom dispatch event even if the selection has been set to false. Let's say I want to remove additional cookies as soon as I confirm I no longer wish to allow google analytics - it's painfully hard to enable/disable analytics as it is. So I've injected the analytics script as soon as on:analaytics was fired, but then again as soon as I summon the cookie prompt and set analytics to false there's no way for me to tell to either reload the page or remove all cookies and scripts associated with it. Hope that makes sense @antony https://github.com/antony.
TL;DR: either enable a callback on confirm which would return the currently selected cookie states (a simple true/false for each of them) or dispatch events for each selection no matter if the choice was true or false.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/beyonk-adventures/gdpr-cookie-consent-banner/issues/7?email_source=notifications&email_token=AABVORPTJQOCDPQHFBQU233QXDXAVA5CNFSM4JVYYMB2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H6JZLWQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABVORORID22R4EEGKPLJNLQXDXAVANCNFSM4JVYYMBQ .
--
ꜽ . antony jones . http://www.enzy.org
I would also appreciate the possibility to define a callback when opting-out. I’m not sure if I have the resources to implement it myself at the moment though. Have you started working on it @mariojankovic?
Hey @silllli, unfortunately no. I do think that I managed to do something but I never released a PR for it. If I dig it up somewhere I'll keep you posted.
Closing due to inactivity