Caching with different cookie states
-
Suppose the following scenario:
A GDPR-Cookie Plugin uses a cookie to determine whether the user gave consent to the use of cookies AND to which degree he or she did so. The state of the cookie may vary between
{"strict":"1","thirdparty":"0","advanced":"0"}
{"strict":"1","thirdparty":"1","advanced":"0"}
{"strict":"1","thirdparty":"1","advanced":"1"}or not being set at all.
Depending on that state, the plugin allows for the use of hooks in a given WordPress-template to conditionally load content that uses cookies (e.g. a google-maps iframe). For example:
if ( gdpr_cookie_is_accepted( 'thirdparty' ) ) { // Here goes the code that echoes the google maps iframe }I know that it’s possible with W3 Total Cache to create a unique cache of a page depending on whether a cookie is set or not by using cookie groups. While this works fine and as expected I fail to set it up in a way that creates a unique cache of a page for each state that cookie may have (so one version of a page where strict cookies are allowed, one where strict cookies _and_ 3rd-party cookies are allowed and so on)
Is it possible to do something like that?
The topic ‘Caching with different cookie states’ is closed to new replies.