• Resolved ropezg

    (@ropezg)


    Hello

    since activating Litespeed caching (latest version) I noticed a big discrepancy in google analytics. Most of the traffic is marked as Direct.

    I found an earlier thread about how this was solved but, it seems it hasn’t.

    This is the google analytics code that I use:

    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-xxxxxx"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'UA-xxxxxxx-1');
      gtag('config', 'G-xxxxxxx');
    </script>
    

    I’ve added under JS excludes and JS Deferred excludes:

    analytics.js
    gtag

    Now I’ve also added those under Guest mode excludes which impacts the Pagespeed score negatively.

    Is there anything else I should do or change in order to solve this?

    thank you!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Is there anything else I should do or change in order to solve this?

    ….and you purged the cache after the changes?

    Thread Starter ropezg

    (@ropezg)

    I did. If I check Realtime analytics the percentage of direct visits seems too high, but I will know after a few days if the trend is normalizing.

    I keep running into problems. I run litespeed caching on 3 websites on the same VPS with openlitespeed web server.

    On one website I noticed, after I updated today to the latest version of the plugin plus added those excludes above, litespeed caching is no longer working. Pagespeed score dropped from 95 to 46-50. Seems that guest mode caching is not working on mobile.

    Is it normal that .htaccess file doesn’t contain any of the litespeed caching directives? ??

    Thread Starter ropezg

    (@ropezg)

    my mistake. htaccess is not empty.

    wordpress installation is inside a wp directory (public_html/wp/)

    .htaccess file in public_html folder only contains wordpress directives.

    .htaccess file in public_html/wp/ has wordpress directives plus litespeed directives etc.

    is that alright?

    Plugin Support qtwrk

    (@qtwrk)

    please provide the report number

    you can get it in toolbox -> report -> click “send to LiteSpeed”

    Thread Starter ropezg

    (@ropezg)

    I did. as it happens on all litespeed installations here are two reports:

    Report number:?BGFPBXNO

    Report number:?SLEQEJCU

    thank you!

    Thread Starter ropezg

    (@ropezg)

    just to confirm that I still face the same issue.

    distribution of traffic channels is skewed (too much direct traffic) and pages per visits are higher than normal.

    I forgot to mention that I use cloudflare, if that can make any kind of impact

    Plugin Support qtwrk

    (@qtwrk)

    hmmm , I don’t think CF will affect this part

    please create a ticket by mail to support at litespeedtech.com , with reference link to this topic , one of our devs will check up with you on this issue.

    Thread Starter ropezg

    (@ropezg)

    support was contacted. still trying to find the solution

    John

    (@graphical)

    We have the exact same problem on a couple sites. Any update ?

    • This reply was modified 1 year, 6 months ago by John.
    Thread Starter ropezg

    (@ropezg)

    putting this code on top of the page before GA code solved the problem when it comes to high percentage of direct visits.

    <script data-no-optimize="1">var litespeed_docref=sessionStorage.getItem("litespeed_docref");litespeed_docref&&(Object.defineProperty(document,"referrer",{get:function(){return litespeed_docref}}),sessionStorage.removeItem("litespeed_docref"));</script>

    however, the pageviews is still higher than it should be

    John

    (@graphical)

    @ropezg Interesting.

    Pageviews are higher only when guest mode is activated?

    Pageviews are higher only when guest mode is activated?

    Because the initial request is loaded twice.

    https://blog.litespeedtech.com/2021/06/01/guest-mode-for-wordpress-in-lscwp-v4-0/

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘litespeed and google analytics error’ is closed to new replies.