elleracompany / craft-cookie-consent

GDPR-Compliant cookie consent banner for Craft CMS
Other
6 stars 5 forks source link

Check whether consent is given via javascript #50

Closed luke-nehemedia closed 3 years ago

luke-nehemedia commented 3 years ago

Hello

I am trying to implement this plugin on a site that uses static caching via Blitz! I was already able to get everything going but now I wonder how to set the cookies. I think it's best to check whether the cookie is set on the client side.

Is there any javascript-equivalent to craft.cookieConsent.getConsent('slug') for javascript?

jellingsen commented 3 years ago

Not a javascript function, no. But you could solve it with something similar to: https://github.com/elleracompany/craft-cookie-consent/issues/30#issuecomment-696177363.

I will be updating the plugin with endpoints for both csrf and consent; but this should give you a temporary solution.