- Issue created by @jberg1
- π³π΄Norway svenryen
Hi!
I'll try to help, though normally a JavaScript approach would be best.
Do you serve a Drupal site without any caching layer?
- πΊπΈUnited States jberg1
Thanks for your reply Svenryen.
Currently working with Drupal 7 website, here is what I managed to do.
First, I installed the Cookie-Aware Page Cache β module that allowed me to remove that cookie from cache. Cookie name specified with EU Cookie Compliance (GDPR Compliance).Then using this PHP to check the cookie value in my PHP I'm doing this.
if(isset($_COOKIE["cookiename"]) && $_COOKIE["cookiename"] == "2" ) { do something... }
This allowed me to only present template parts if they have agreed to accept the cookies. Mainly used to show/hide blocks I have for Tracking codes.
I'll be figuring out a way to do this with Drupal 9 (and 10). But unclear on how to remove a specific cookie from the Cache in that Drupal verison. Since that Cookie-Aware Page Cache is only available for Drupal 7.
Any advise is welcome.
Thanks again. - π³π΄Norway svenryen
I don't really know, and it's a bit beyond what we can offer support for free of charge. I just know cache is usually an issue and many sites prefer to use a javascript based approach where cookie aware information is injected through ajax. That should also work in 9 and 10, and the request to the cookie related information can be cached too.
If you're interested, I work for an agency that can analyse your needs and offer paid support and likely solve your issue. Please contact us at ramsalt.com if that's of interest.