Can you walk me through, in plain terms, the way your plugin is intended to work?
Let’s say a first-time visitor arrives for the first time. Assuming WPSC Simple caching is enabled, are they still served a supercached page? If so, how does that supercached page treat page content that’s selectively enabled or disabled by conditional tags based on cookie values?
As soon as a visitor lands, the GDPR plugin places its initial set of cookies and pops up the notification/consent banner. Once the user clicks the acceptance button, the GDPR plugin attempts to reload the page. (This is one of GDPR plugin’s configuration options.)
When this happens, will the visitor then be treated as a known user and the page rebuilt (which would allow the conditional tags to run) rather than just refreshing the supercached version?
Let’s say the same user leaves and then comes back the following day, still with the saved GDPR cookies. Will they be treated as a known user or will they be served a supercached page?
I’m sorry to be dense — I don’t understand the code very well, so I have to think in terms of the underlying logic so I can figure out an appropriate way to test it that will be useful to both of us.
(I really appreciate your help with this, by the way. This is very challenging for a non-developer!)
We have 3 groups of visitors:
- Anonymous visitor ( first-time visitors or “empty cookies” )
- Consented visitor ( cookies contain “consent_types” or “allowed_cookies” )
- Logged user (know user in WPSC).
Maybe, it isn’t described well, but I think that you understand.
When anonymous visitor gets page, WPSC serves supercache file. All GDPR functions return false because GDPR cookie is empty (doesn’t exist or arrays consent_types/allowed_cookies are empty). If WPSC served page then initial cookie isn’t set (because GDPR plugin isn’t loaded – it isn’t an issue because JS will set cookie when anonymous visitor clicks on privacy banner).
When anonymous visitor clicks on privacy banner then JS (GDPR plugin) makes ajax request which processes changes/set cookies (ajax request or JS can set cookie). Next step is reload and browser sends cookie via header. Our GPDR plugin decodes cookie content and WPSC serves/stores properly wp-cache file (WPSC doesn’t touch supercache file in this case). In cache directory, you will see two new files ( meta-wp-cache-….php and wp-cache-….php). These files contain page with “enabled content” (because GDPR functions return true based on cookie values). WP-Cache file is gzipped if it’s requested (WPSC makes only one cache-file variant based on request’s header).
Consented visitor has saved cookie in browser (until he/she purges cache – default expiration for GDPR plugin is one year I think). Browser always sends cookie and our GDPR plugin will “decode cookie”. So, WPSC for consented visitors always stores/serves wp-cache files.
Logged users should be excluded from caching when we merge PR #616. For now, they and consented visitors are overlapping. I’ve tried to make some workaround in our GDPR plugin which isn’t perfect, but we will improve it in the future.
No problem, it’s good to we make test cases and find the weakest point in the code. I’ll have limited time in next week (or two weeks), maybe my replies will be little delayed.
Understood — thanks so much for spelling this out. Let me run some tests and see what kind of results I get. I’ll post here when I have some feedback.