cookie consent cache pages
-
Hi,
I’ve been noticing that some pages are cached with analytics cookies.
I have a cookie consent plugin that blocks tracking cookies scripts till it receives a consent from the user.
Visitors who give consent have been visiting pages allowing them to cache with the analytics code in the page code. Leading to newcomers getting analytics cookies even before giving consent.I have added this code I found online in the wp optimize plugin file (file-based-page-cache.php):
if(empty($_COOKIE['cookie_notice_accepted'])){ return; }
This served cached pages only for those who give consent and accepts the cookie notice. So those who don’t give consent gets fresh pages without analytics code and cookies injected in them.
This worked like a charm, till I realized that the preloading feature is not caching any new pages, which makes sense. The preloader is like an anonymous page visitor that doesn’t click on the OK button on the cookie notice, am I right?
I am unfortunately not a PHP guy. Can we find a solution for my issue?
Like:
if(empty($_COOKIE['cookie_notice_accepted'])){ return; }
But with an exception for wpo preloader?
Kind regards,
Haytham Asaya
- The topic ‘cookie consent cache pages’ is closed to new replies.