Script Not Deferring With Plugin

sharingsunshine
sharingsunshine used Ask the Experts™
on
I am working with pagespeed and gtmetrix and they both say I need to defer this script - https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js 

As you can see in the plugin async javascript I have this listed to defer

https://gyazo.com/6d3ba7273cb4256ebb7a3eed49d9cb6d

However, looking at the source at https://www.theherbsplace.com/product/artemisia_combination_p_163/?loggedout=true you can see that the script isn't being deferred.  

Here is the gtmetrix readout - https://gyazo.com/533542c729b4e15b20cc0f5ca9799bb1

How do I get this script to defer?  Is there another method that is better?

Thanks,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
pagespeed and gtmetrix are both lying to you.  That script Must load first before any jquery statements are executed.  Deferring it will always cause problems.
Fractional CTO
Distinguished Expert 2018
Commented:
Okay... +1 for Dave's comment. I was going to be more politically correct because EE internal staff continually rag on me for being blunt.

Never believe what PageSpeed + GtMetrix tell you.

Use https://WebPageTest.org instead, as WPT will tell you reasonable things to fix which will actually be beneficial.

For example, you're running WordPress, so if you start mucking around with when JQuery loads you'll likely end up with a serious mess of subtle problems which will be impossible to debug.

Stick with WPT instead.

Suggestion: Work with someone who truly understands WordPress along with the entire LAMP Stack, before you take advice about any odd WordPress or LAMP changes.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
As Dave Baldwin + I mentioned, the Google PageSpeed tool is one of the few tools Google provides which produces bogus suggestions.

GTMetrix is certainly the worst. PageSpeed is a close second.

WebPageTest provides correct/actionable items to fix... which won't destroy your site function, like PageSpeed or GTMetrix.

A simple example, if you remove file version strings like many tools suggest, your site will develop buggy behavior over long periods of time, because you'll end up with mismatched .js + .css files scattered through visitor's browser caches, which produces an impossible to debug + fix problem.

Stick with WebPageTest. All provided tuning suggestions are correct.

Author

Commented:
I'll start using webpagetest from now on.  It does give much more detail on how to improve the site.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial