Forums » Plugin: LiteSpeed Cache » Problem with inline JS // GDPR Plugin

  • Resolved holgee

    (@holgee)


    Hello,

    I have a problem with a GDPR Plugin (Cookie Notice & Compliance for GDPR / CCPA) as the cookie banner is loaded partly only on some pages. The plugin places an inline JS on every page. I have already turned off all CSS and JS optimization settings in the LightSpeed Plugin Tool and of course cleared all caches after that. But nevertheless, after a few days, the cookie banner is only shown on some pages. I have also tried to set the following java script exclude in the LightSpeed Settings (Page Optimization => Tuning)

    cookie-notice-front-js-extra
    ;
    ,
    =

    But the error remains. Only when the Light Speed Cache is turned off completely, the mentioned problem doesn´t occur.

    I would be very happy, if there is a solution or a kind of help regarding this issue, as I really would like to keep LS turned on.

    If there is something I could provide for further assistance, please let me know.

    Many thanks in advance for your help.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Support qtwrk

    (@qtwrk)

    please try add

    <IfModule LiteSpeed>
    RewriteEngine On
    RewriteRule .* - [E=Cache-Vary:cookie_notice_accepted]
    </IfModule>

    at top of your .htaccess, purge all

    Thread Starter holgee

    (@holgee)

    Hi @qtwrk
    Hi @tenkstars

    many thanks for your replies and your help!
    I´ve added the mentioned Rewrite Rule in the .htaccess file, re-anabled the cache and all Page Optimization settings in the LSCache WP Plugin. The .htaccess file now has the following entries:

    <IfModule LiteSpeed>
    RewriteEngine on
    CacheLookup on
    RewriteRule .* - [E=Cache-Control:no-autoflush]
    RewriteRule .* - [E=Cache-Vary:cookie_notice_accepted]
    RewriteRule \.object-cache\.ini - [F,L]
    [...]

    As mentioned, the “error” occurs after some days, so I’ll keep watching the site and give a corresponding feedback here.

    • This reply was modified 2 years, 10 months ago by holgee.
    Plugin Support qtwrk

    (@qtwrk)

    no , don’t add it within the LSCWP marker , add it at very top of your .htaccess , outside of LSCWP marker

    because if you added inside LSCWP marker, each time you change the setting , it will be overwritten

    • This reply was modified 2 years, 10 months ago by qtwrk.
    Thread Starter holgee

    (@holgee)

    Hi,
    oh – ok! Many thanks for the detailed info!
    I´ll put it on the very top instead then.

    Many thanks for your help! I´ll post a feedback regarding this in the next days …

    Plugin Support qtwrk

    (@qtwrk)

    sure, please keep me posted.

    Thread Starter holgee

    (@holgee)

    Hi,
    unfortunately, the problem still exists. I have added the mentioned ReWrite Rule to the top of the .htaccess file, but after a few days, the Cookie Banner was still not loaded on some pages. I also tried to change the ReWrite Rule to the following:

    <IfModule LiteSpeed>
    RewriteEngine On
    RewriteRule .* - [E=Cache-Vary:cookie-notice-front-js]
    </IfModule>

    as “cookie-notice-front-js” is the ID of the script. But also this had no effect.
    Furthermore, I have tried to clear the entire cache via Toolbox => Empty Entire Cache. Maybe this will help. As mentioned, the problem occurs oddly enough after a few days – so I will keep watching the site but I guess, the problem won´t disappear …

    I have also send a Report to you – the corresponding Number is BSQWTNKT.

    Many thanks in advance for your help!

    • This reply was modified 2 years, 10 months ago by holgee.
    Plugin Support qtwrk

    (@qtwrk)

    
    <IfModule LiteSpeed>
    RewriteEngine On
    RewriteRule .* - [E=Cache-Vary:cookie_notice_accepted]
    </IfModule>

    please try this instead, and make sure you do a purge all after you changed the rule

    Thread Starter holgee

    (@holgee)

    Hi,
    many thanks for your reply!
    I have changed the ReWrite Rule back to your mentioned one and cleared all caches via Toolbox => Emptiy entire cache. I will keep watching the site for a few days and give an update here afterwards.

    Thread Starter holgee

    (@holgee)

    Hi,
    many thanks for your help – but unfortunately, the problem still exists. I have placed the Rewrite Rule on top of the .htaccess file like this:

    # Exception for LSC
    <IfModule LiteSpeed>
    RewriteEngine On
    RewriteRule .* - [E=Cache-Vary:cookie_notice_accepted]
    </IfModule>
    # BEGIN LSCACHE
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    <IfModule LiteSpeed>
    RewriteEngine on
    CacheLookup on
    RewriteRule .* - [E=Cache-Control:no-autoflush]
    RewriteRule \.object-cache\.ini - [F,L]
    
    ### marker NOCACHE COOKIES start ###
    RewriteCond %{HTTP_COOKIE} cookie_notice_accepted
    RewriteRule .* - [E=Cache-Control:no-cache]
    ### marker NOCACHE COOKIES end ###
    
    ### marker CACHE RESOURCE start ###
    RewriteRule wp-content/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php - [E=cache-control:max-age=3600]
    ### marker CACHE RESOURCE end ###
    
    ### marker FAVICON start ###
    RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400]
    ### marker FAVICON end ###
    
    ### marker DROPQS start ###
    CacheKeyModify -qs:fbclid
    CacheKeyModify -qs:gclid
    CacheKeyModify -qs:utm*
    CacheKeyModify -qs:_ga
    ### marker DROPQS end ###
    </IfModule>

    Afterwards, all caches has been cleared and additionally the Toolbox => Clear entire cache function was used. But, after a short period of time the cookie banner is not loaded on some pages. I have turned of the cache function now and sent you a report. The ID is: HYUXACXF

    If there could be a kind of “workaround” or help, I would be very happy.

    Many thanks in advance.

    Plugin Support qtwrk

    (@qtwrk)

    Thread Starter holgee

    (@holgee)

    @chenhanqiongdemaiya
    Thanks for your reply and suggestion! But the Banner is placed on the Bottom 😉

    Thread Starter holgee

    (@holgee)

    @qtwrk
    yes that´s the one 😉

    Plugin Support qtwrk

    (@qtwrk)

    hmmmm , it actually works on my test site

    do you have a pattern for how it will occur ? only after few days ?

    Thread Starter holgee

    (@holgee)

    @qtwrk
    Big thanks for your kind help and support!
    Unfortunately, there is no direct “pattern” – when the caching is activated, the banner is not loaded on some pages – for example the “contact” Page, or the “about me” Page. Even when I had cleared all caches, the banner then was loaded on the “contact” and “about me” Page, but not in the “privacy policies” Page. But I have re-activated the LS Cache now and I´m pretty sure, that the “problem” will occur timely. So I would suggest, that I would then send you a corresponding link, where the banner is not loaded. And yes, it only occurs after a short time, not directly after activating the LS Cache or clearing the entire cache. I have also tried to load the page with different Browsers (all Browser Caches was cleared formerly) – but there is no difference regarding the “problem”.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    please try add this into your theme’s functions.php

    and then purge all , see if it helps

    add_filter( 'litespeed_vary_cookies', function( $list ) { $list[] = 'cookie_notice_accepted'; return $list; } );

    if you are testing on your own browser please make sure have cleaned up the browser cache

    and if it doesn’t pop up when/where it supposed to be , please also check in your cookie , looking for the value of cookie_notice_accepted

    Best regards,

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Problem with inline JS // GDPR Plugin’ is closed to new replies.