Support » Plugin: Complianz - GDPR/CCPA Cookie Consent » Complianz causes page to continuously refresh with Litespeed cache

  • Resolved sdesign

    (@sdesign-1)


    Hi

    I’ve just moved my site to another web host and have enabled the lite speed cache. I’ve now got a problem with the cookie banner. If I reject all cookies the page loads fine, but if I accept all cookies then the page starts to refresh continuously.

    I wasn’t sure what was causing it at first so I was disabling plugins to see what was causing it. The site loads fine when complain is disabled, but when enabled and all cookies are accepted then it just keeps refreshing.

    There is an option in the lite speed cache plugin to exclude cookies or scripts from being cached. Maybe this would help?

    Any advice?

    Thanks
    Alex

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    Can you try to disable all integrations in complianz/integrations?

    Complianz does not reload on consent, so maybe it’s an integration.

    Thread Starter sdesign

    (@sdesign-1)

    Hi,

    I tried to disable all the integrations but it didn’t help.

    Any other ideas?

    Thanks

    Alex

    Thread Starter sdesign

    (@sdesign-1)

    Hi

    “Complianz does not reload on consent, so maybe it’s an integration.”

    Thats strange as my site has always appear to refresh itself when I consent (like when I enable marketing cookies on a map). Maybe this is related?

    Edit: I just turned the LiteSpeed cache off and tested the site. The site definitely refreshes the browser whenever all cookies are selected, when enabling marketing cookies (on map etc.) or when consent is revoked via the cookie policy.

    Thanks

    Alex

    • This reply was modified 2 years, 6 months ago by sdesign.
    Thread Starter sdesign

    (@sdesign-1)

    Hi

    I figure out what is causing the issue.

    I have used the [cmplz-consent-area][/cmplz-consent-area] shortcode to block content until marketing cookies are accepted. On these pages, when you “accept all” in the cookie banner or enable marketing cookies by clicking on the blocked content, then browser will refresh that page. If I have the LiteSpeed Cache enabled this will cause it to continuously refresh.

    If I remove the [cmplz-consent-area][/cmplz-consent-area] shortcode from my site, and then enable LiteSpeed Cache, there are no issues at all. If I choose “accept all” cookies in the cookie banner or enable/disable marketing cookies on the Cookie Policy.

    So it is a problem caused by the page being refreshed when selecting marketting cookies while using the shortcode.

    Do you think this is something that can be fixed?

    Thanks

    Alex

    • This reply was modified 2 years, 6 months ago by sdesign.
    Thread Starter sdesign

    (@sdesign-1)

    Hi

    So after a little bit of experimentation I think I can see what’s going wrong.

    When enclosing content in the [cmplz-consent-area][/cmplz-consent-area] shortcode, the “click to enable marketing cookies and enable content” box is being cached by LiteSpeed Cache. Then when the visitor clicks “Accept All” in the cookie notice, the page is trying to refresh to show the content (which is what usually happens when using the shortcode) but can’t because the page has been cached.

    LiteSpeed Cache does have an ESI mode (Edge Side Includes) that lets you exclude content from the cache.

    From their documentation:
    “ESI allows you to designate parts of your dynamic page as separate fragments that are then assembled together to make the whole page. In other words, ESI lets you “punch holes” in a page, and then fill those holes with content that may be cached privately, cached publicly with its own TTL, or not cached at all.”

    So, for example, I have used ESI to exclude my rotating banners by changing

    [adrotate group=”1″]

    to

    [esi adrotate group=”1″ ttl=”0″]

    I tried to use ESI with the [cmplz-consent-area][/cmplz-consent-area] shortcode like so [esi cmplz-consent-area ttl=”0″] but that just stopped the shortcode working.

    I’m not sure where I go from here. I think I need to find a way to exclude the [cmplz-consent-area][/cmplz-consent-area] shortcode from the cache.

    Any thoughts?

    Thanks

    Alex

    Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    Yes, that makes sense. Because you use a server side consent mechanism, the shortcode, a reload is required on consent. But as the page is cached, this can cause issues.

    This is why we prefer client side solutions. But not all plugins support this, which is why we offer the shortcode solution as well.

    In cached situations, you can add the cache_redirect=true attribute to the shortcode. The page will now redirect on consent, instead of reload.

    For more details on this, see also this article:
    https://complianz.io/wrapping-content-in-consent-shortcodes/

    Thread Starter sdesign

    (@sdesign-1)

    Thanks I’ll give the redirection a go.

    Kind regards

    Alex

    Thread Starter sdesign

    (@sdesign-1)

    Hi

    I tested using the cache_redirect=true attribute and, while it solves the problem of the page refreshing over and over, it does introduce a considerable delay in page load time through the site as every page containing the consent area has to redirect every time its loaded (not just when accepting cookies.

    If you were able to do an integration for Amazon Affiliate links (as you have for google maps) would this issue be resolved?

    Kind regards

    Alex

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @sdesign-1,

    In this case (assuming that it still concerns the same website from earlier), the tracking functionality comes from the image source(s). Integrating would mean that we have to block all of these images prior to consent. You can already block images from third-party sources with this MU Plugin: https://github.com/Really-Simple-Plugins/complianz-integrations/blob/master/block-images.php

    Or hardcode the images and add your affiliate links as hyperlink to avoid “amazon-adsystem.com” altogether. You wouldn’t have dynamic entries, but it would avoid this kind of tracking.

    Kind regards,
    Jarno

    Thread Starter sdesign

    (@sdesign-1)

    Hi

    Thanks for your help. Yes it’s the same website. As mentioned in the other thread I can’t hyperlink the images as it’s against Amazon’s terms and conditions. They will review my site at some point and could remove the site from the affiliate program.

    I’ve installed the block-images.php MU Plugin as you suggested, but it doesn’t seem to block the images. How is the plugin supposed to work? I’ve just dropped it into the wp-content/mu-plugins folder. I’m assuming there is nothing else I need to do to make it work?

    Thanks for your help!

    Alex

    Thread Starter sdesign

    (@sdesign-1)

    Hi

    I just tried adding the filer to my child themes functions.php file. Still not blocking the images.

    Kind regards

    Alex

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @sdesign-1,

    You will have to modify the script slightly for your specific purpose. On line 17 between the ”, add (a part of) the image source. In your case, you can try adding ‘amazon-adsystem.com’.

    Kind regards,
    Jarno

    Thread Starter sdesign

    (@sdesign-1)

    Hi

    Apologies I missed that 🙂

    So I’ve updated the code with amazon-adsystem.com and it blocks the images now. However, this filter blocks the images for everyone, not just those that have declined marketing cookies so isn’t useful for my purpose as obviously I want to show the images for those that have accepted all cookies. For your info, it also doesn’t lock the tracker.

    Thanks

    Alex

    Thread Starter sdesign

    (@sdesign-1)

    Hi

    I’m probably clutching at straws here, but there are excludes options in the LiteSpeed Cache plugin. Maybe I could somehow exclude the area blocked with the [cmplz-consent-area][/cmplz-consent-area] shortcode from being cached?

    The LiteSpeed Cache options for exclusion are:

    Do Not Cache URIs
    Do Not Cache Categories
    Do Not Cache Tags
    Do Not Cache Query Strings
    Do Not Cache Cookies
    Do Not Cache User Agents

    I also own another cache plugin called CometCache. This allows you to create multiple dynamic versions of the cache. Maybe this could be used?
    https://cometcache.com/kb-article/introduction-to-dynamic-version-salts/

    Thanks
    Alex

    Plugin Contributor jarnovos

    (@jarnovos)

    Hi @sdesign-1,

    You can always experiment with these specific caching features that you mentioned, to see if it provides better results for you. But for now it looks like the “cache_redirect=true” parameter (redirect on consent instead of on reload) with the resulting additional delay, might be the most appropriate solution for this use-case.

    I’ve marked the thread as resolved for now, but feel free to reach out if you have further questions about the plugin.

    Kind regards,
    Jarno

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Complianz causes page to continuously refresh with Litespeed cache’ is closed to new replies.