• Resolved anjoid

    (@anjoid)


    Hi, when I have your plugin activated my site speed slows down.

    The slow script appears to wp-admin/admin-ajax.php?action=wooptpm_get_cart_items

    Is there anyway to prevent this from slowing things down?

    See here: https://prnt.sc/111t43n

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author alekv

    (@alekv)

    Hi @anjoid

    That’s a call that happens after page load and therefore doesn’t slow down page load or rendering of the page.

    • This reply was modified 3 years, 7 months ago by alekv.
    Thread Starter anjoid

    (@anjoid)

    I’ve disabled it and page is faster and scoring higher on speed tests. The script is will active on pages such as check just disable on product pages.

    Do you know if it’s necessary on product pages?

    Plugin Author alekv

    (@alekv)

    Do you know if it’s necessary on product pages?

    We can’t render the cart server side because we would run into issues with caching mechanisms that cache HTML and would not output the correct cart content. So yes, we need to load this on every page for each visitor individually.

    We run that function on the document.ready event, which in my opinion is safe and would not interfere with effective page load speed, because the function doesn’t interact with the visible elements of the page.

    Having said that, thanks to your report I did some more research. Apparently PageSpeed Insights for instance counts everything into the load time that happens before the document.load event. (More info here and here.) That means document.ready is too early for PageSpeed Insights.

    I’ll move the function call to after document.load, then the pagespeed test should be fine.

    Probably this will be published with the next version in a week or so.

    • This reply was modified 3 years, 7 months ago by alekv.
    Thread Starter anjoid

    (@anjoid)

    Awesome sounds good thanks for the update!

    Plugin Author alekv

    (@alekv)

    @anjoid

    The new version with the fix is out. Let me know if it improves pagespeed measurements for you.

    Thread Starter anjoid

    (@anjoid)

    Hey still shows the longest load time https://prnt.sc/118bn1r, I’m going to do some more a/b testing

    Plugin Author alekv

    (@alekv)

    The Ajax call itself will never be fast.

    The question is, if it happens during page load where the call can block and delay page load and rendering, or if it happens after.

    The way how it is implemented now, it is for sure loading after the page loaded, so it won’t delay anything.

    What’s the website in question? You can send it to [email protected] if you want.

    hello @alekv

    I found similar problem like OP wrote.

    ?action=wooptpm_get_cart_items is slowing down website about 1,2-1,5s.

    Does new update should solve this problem? I tried to find solution in the web but didnt get anything interesting

    Plugin Author alekv

    (@alekv)

    Hi @cometto

    The ?action=wooptpm_get_cart_items call happens after the browser has signalled the load event, which happens when all content has already been successfully loaded.

    The load event is fired when the whole page has loaded, including all dependent resources such as stylesheets and images.

    Reference

    PageSpeed measures the loading time of your page starting from the initial request to when the last embedded resource (JS, CSS, images, etc.) has finished loading. So that’s essentially when $(window).load() is triggered.

    Reference

    So the ?action=wooptpm_get_cart_items doesn’t slow down the download or rendering of your website in any way.

    • This reply was modified 3 years, 7 months ago by alekv.

    Hi, thanks for this plugin, however, I’ve discontinued using it after a couple of days because I noticed my PageSpeed Insights/Lighthouse scores were significantly affected when it is active.

    For example, a product page was getting 78 (mobile) & 97 (desktop) on PSI dropped down to 50 (mobile) & 91 (desktop).

    I ran tests several times to ensure caching etc weren’t the issue. Mobile is clearly the most affected, and it appears that increases in Time to Interactive and Total Blocking Time are the reason for the lowest score on mobile test.

    With the plugin enabled, I get 6.8s for Time to Interactive, and 410ms for Total Blocking Time. Without plugin active, I get 3.0s and 0ms respectively.

    I’d love to know if this if fixable.

    Best regards,
    Mike

    Plugin Author alekv

    (@alekv)

    Hi Mike

    I assume you were using mainly the Google pixels.

    My plugin injects the scripts exactly as specified by Google, plus it adds a few very lightweight scripts of its own (which PageSpeed Insights doesn’t report). Ironically PageSpeed Insights mainly complains about the Google tracking scripts.

    But, if you want to track your visitors, and generate revenue by running successful campaigns, then you’ll have to track the visits correctly. So you have to use tracking scripts, one way or the other.

    You can try switching to Google Tag Manager. But, it is much more complex to set up correctly and not as easy to adjust when new pixel features are released. At the same time it’s not a guarantee that the scripts load faster using the GTM. It is essentially loading the same scripts. (Or even better you switch to server side GTM. But that’s even more complex to set up and comes with additional cost.)

    PageSpeed Insights isn’t perfect in two ways.

    1. From what I can tell it essentially uses a points based system to tell you if the website loads fast or not. The problem with that is, that it doesn’t measure what the real end user experience is. It can be off by a huge margin, but pages still load just fine and fast. I therefore like much more using https://www.webpagetest.org/. It uses a real world approach in a way that it measures what the visitor actually sees and it doesn’t weigh resources (such as scripts) that don’t affect the visual representation and rendering time.

    2. Secondly PageSpeed Insights doesn’t tell you how much more or less money you make with your website based on its score. If the score is just 50%, does it mean you make only 50% revenue with your campaigns? No, absolutely not! In the contrary. If using a specific script slows down the website a little, but generates more revenue, then what’s that PageSpeed Insights score worth to you?

    3. PageSpeed Insights only tells you what it sees on the first page load. But all the scripts get cached by the browser after the first page load. That means loading the scripts is a lot faster while the visitors browses your shop.

    Then, there are methods to trick PageSpeed Insights to think those scripts are not being loaded. Many JavaScript optimization tools do that. But, they all impact measurement accuracy, sometimes even break tracking entirely. That’s bad for every paid ads campaign performance big time.

    There is no perfect world. If you want to measure your traffic, optimize your campaigns and optimize your campaign revenue you have to measure your traffic correctly.

    At the end it comes down to striking the right balance and finding out what increases your chances to generate most revenue. If you don’t run any paid ads campaigns and it’s not important to you if your website generates revenue, then you don’t need a good tracking set up.

    But, if you generate revenue with your shop and run campaigns with a decent budget, then you want to have a tracking solution that is working really well, even if it doesn’t satisfy PageSpeed Insights perfectly. So basically you have to ask yourself, if by adding tracking scripts and increasing the page load time a little bit, will you make more or less money.

    That’s a question that only you can answer. PageSpeed Insights is not made to answer that question.

    Regards
    Aleksandar

    PS: Next time please create a new thread for your own question. It’s a forum rule.

    • This reply was modified 3 years, 3 months ago by alekv.
    • This reply was modified 3 years, 3 months ago by alekv.
    • This reply was modified 3 years, 3 months ago by alekv.
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘script causing slow page load’ is closed to new replies.