• With this website we have added all external scripts to the JS Delayed Includes field. But the scripts are all loaded at page load and not at first interaction.

    How can I make it work so it will only execute when the visitor performs the first interaction on the website?

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

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Support litetim

    (@litetim)

    Thread Starter DODO Internet

    (@studioviv)

    Hello @litetim ,

    The LSC cache is enabled, otherwise I don’t know what you mean with the second question. The “Load JS Deferred” is set to “Deferred”. I’ve added the (partial) URL’s in the tab “Tuning” in the field “JS Delayed Includes”.

    Plugin Support litetim

    (@litetim)

    @studioviv First visit(if not cached) is normal to be miss.
    I asked about LSC being enabled because homepage, and a few pages I tested, show “Page uncached” and page headers have “x-litespeed-cache-control: no-cache”.
    From the html generated I see that something disable LSC functionality.

    Please share a report: send it to Litespeed and share the ID generated.
    We have this link to help you share the report: https://docs.litespeedtech.com/lscache/lscwp/troubleshoot/#get-a-report-number

    Thread Starter DODO Internet

    (@studioviv)

    Hello @litetim ,

    I know the first visit is a miss. That is weird you see the “no-cache” message. Because I see on most pages the miss or hit message.

    Report Number: ZJHHNYVP, is this what you wanted?

    Plugin Support litetim

    (@litetim)

    @studioviv
    Litespeed plugin settings seems to be ok
    I see you have Cloudflare plugin activated. What you are using it for?
    Try disabling it and look for code that would disable LSC functionality or that change headers.

    Thread Starter DODO Internet

    (@studioviv)

    Hello @litetim ,

    We use Cloudflare for bat traffic control and have the ability to clear the Cloudflare cache through the site. But we and our server hoster are not thinking this is causing the issue.

    I don’t know why you have the “no-cache” message. I have the “x-litespeed-cache” set to “mis” or “hit”. My main issue is why the deferred mode is not working. Can you tell me about that issue more? I see at a lot of scripts the HTML tag “data-deferred=”1″”. Maybe it has something to do with that? Or is it possible that because the scripts are set to a Litespeed JS file (intern) the file are not reconized as a script from the deferred list?

    Thread Starter DODO Internet

    (@studioviv)

    Hello @litetim ,

    Our server hoster found an issue with a cookie, which was excluded from cache. Because of that the caching was set to “no-cache”. We removed that cookie from the exclude list. Maybe now the caching is also set to mis or hit with you.

    Plugin Support litetim

    (@litetim)

    @studioviv
    I see x-litespeed-cache: hit now. What cookie did you removed from exclusion list?


    Ok, let’s go with the ideea CF is not to blame. BUT keep in mind that using 2 cache layers, which do not work the same, will result in not correct data showed. LSC has a setting to clear CF on purge all (see here).

    data-deferred=”1″ comes from manually adding it to scripts OR after the defer script had run.

    Also there is CF security check when I first visit your site, please be aware of this too 🙂

    Thread Starter DODO Internet

    (@studioviv)

    Hello @litetim ,

    I’ve excluded a custom cookie that stored the “incl/excl tax” information. You can see this in the page headers.

    We didn’t add the data-deferred=”1″ attribute to any scripts. It’s also not present in the code where those scripts are inserted. So LiteSpeed must be adding this attribute itself. Otherwise, I have no idea how or why it appears.

    But is my theory correct? That LiteSpeed renames all scripts using its own internal naming, and because of that the scripts are no longer recognized as matching the deferred‑list entries? Or does my issue have something to do with the data-deferred=”1″ attribute?

    Plugin Support litetim

    (@litetim)

    @studioviv
    Let’s finish the cache headers issue first. I see: x-litespeed-cache-control: no-cache back in headers.
    At this moment pages do not reflect the LSC settings generated in report: ZJHHNYVP
    When I entered the page I do not see any: data-deferred Not even in source, not in developer tools.
    Please disable any other cache layer or plugin you have active.

    Question answers:
    Litespeed is adding that attribute(data-deferred) for all JS when defer is enabled(and they are not excluded).
    Naming is changed when JS combine or minify is enabled(but exclusions will check the original file name).

    Thread Starter DODO Internet

    (@studioviv)

    Hello @litetim ,

    How is the cache control message now?

    So if I understand it correctly. The name changes, combining and minifying excludes all names in the JS Delayed Includes list entries? I do notice that googletagmanager.com (which is in that list) is not renamed, so something is working correctly. But this script is not delayed, deferred or triggered/activated after first interaction of the visitor. So that is still not working. Or am I misunderstanding the fields and field names?

    Just to be clear. I want external scripts, such as googletagmanager.com, to load only after the visitor’s first interaction. Not during or after the page loads. But after the visitor has performed a (minor) interaction. This could be a mouse movement, a click, or something similar.

    Plugin Support litetim

    (@litetim)

    @studioviv

    Cache message: x-litespeed-cache: hit
    I looked if some settings have effect:

    Optimizations Homepage:
    I see minified JS loading in source => good
    I see CSS minified and combined => good

    Optimizations: /mein-account => not cached which is good

    Other questions:
    – yes, name changes for optimized CSS/JS. BUT before name change it will check for exclusions, defers, delays AGAINST original name.
    – if you want for JS to work on after interaction please set: https://docs.litespeedtech.com/lscache/lscwp/pageopt/#load-js-deferred to value Delayed(see docs). This will make ALL JS to run delayed. If the site is not working after this change, it will need some tweaking. Try adding JS that creates problems to: https://docs.litespeedtech.com/lscache/lscwp/pageopt/#js-deferreddelayed-excludes

    Thread Starter DODO Internet

    (@studioviv)

    Hello @litetim ,

    So if I want to make all external scripts delayed, I need to set the Load JS Deferred field under JS Settings option to Delayed to make all scripts delayed, and place the domain super-seat.com (for all internal scripts) in the JS Deferred / Delayed Excludes field under Tuning? But will this also make all internal script be excluded from deferring?

    And what is the function of the JS Delayed Includes field in the Tuning tab? If this is not working…

    Plugin Support litetim

    (@litetim)

    @studioviv
    If you do not exclude specific JS, external JS will be delayed too with no extra settings. Tested with default settings and it delayed all scripts.
    AFTER setting delayed, the site is not working, then start debugging and add scripts to delay exclude.

    Thread Starter DODO Internet

    (@studioviv)

    Hello @litetim ,

    I understand you explanation. But what if I don’t want to delay the internal (from the domain) scripts only the external scripts (like googletagmanager.com, etc)?

Viewing 15 replies - 1 through 15 (of 18 total)

You must be logged in to reply to this topic.