J!Extensions Store™
Faq Can i use page caching while blocking cookies and resources?
Can i use page caching while blocking cookies and resources?
Created on:Thursday, 03 May 2018 00:00

In the case that it's necessary to allow visitors to switch back and forth between accept/decline cookies and resources, the page caching could be a big problem if the same cache is used inconditionally indeed it could prevent the dynamic switching of contents.
The solution is to use the standard Joomla! System - Page Cache plugin that has a feature to separate each cache based on cookie preferences. To enable this feature, it's enough to choose the following option under the GDPR configuration:

auto manage cache

As an alternative you can switch to a third-party caching solution such as JotCache. JotCache can play well with GDPR and they can be configured to cooperate and maintain a well performing website.

All you have to do is to open to the JotCache plugin configuration, go to the “Advanced” tab and enter “#cookieconsent_status” into the “Cookies split” field.
jotcache cookie cache split

In the case that you have enabled categories for cookies, you could need to separate the page cache even based on the categories that have been accepted by a user. The GDPR component doesn't use cookies to store the categories preference, instead this information is stored directly within the Joomla session.
To allow JotCache to split up the cache based on this information, it's required to enter the name of each session variable into the “Session Variables Split“ field:
gdpr split cache by session
The full list of session variables used by the GDPR component is:
#gdpr_cookie_category_disabled_1
#gdpr_cookie_category_disabled_2
#gdpr_cookie_category_disabled_3
#gdpr_cookie_category_disabled_4

After this, you have to fully disable the Joomla! System - Page Cache plugin and set to 'No' the "Automatic cache management" parameter inside the GDPR component configuration.
This will result in separate cache files for users that allow Cookies and for users who do not allow them, without GDPR purging the cache of a page when accessed with different Cookie settings.

Notice that if you are using Development Mode in a JA template pay attention to disable it otherwise JotCache can't work.

If you are using LiteSpeed Cache and the LSCache plugin, it's possible to configured a separate cache based on the cookie consent using the htaccess. Refer to this documentation link for more informations: https://www.litespeedtech.com/support/forum/threads/lscache-rgpd-component-vid%C3%A9os-youtube-et-google-map.19302/