How to avoid issue related to Google Tag Manger in page speed to improve perfomance?

Google Tag Manager is by definition a performance impediment. Its only purpose is to allow non-technical people to dump random garbage very important third-party scripts on a site. If you bypass GTM by inserting the external tags/scripts that you want on your site directly, it will improve performance immediately. If you can’t do that, you … Read more

Possible to defer loading of jQuery?

Try this, which is something I edited a while ago from the jQuerify bookmarklet. I use it frequently to load jQuery and execute stuff after it’s loaded. You can of course replace the url there with your own url to your customized jquery. (function() {   function getScript(url,success){     var script=document.createElement(‘script’);     script.src=url; … Read more

Google PageSpeed – Eliminate Render-Blocking Resources Above the Fold caused from Google Fonts

You can preload any styles (including google fonts) <link rel=”preload” href=”https://fonts.googleapis.com/css?family=Open+Sans:300&display=swap” as=”style” onload=”this.onload=null;this.rel=”stylesheet”” /> <noscript> <link href=”https://fonts.googleapis.com/css?family=Open+Sans:300&display=swap” rel=”stylesheet” type=”text/css” /> </noscript> You can read more on web.dev UPDATE Base on Lucas Vazquez comment I’ve also added &display=swap (which fixes this issue “Ensure text remains visible during webfont load”)

Should I inline all CSS files programmatically to optimize page load speed?

Inlining all your CSS means it cannot be cached, so every single page load will contain all of the CSS required, and when you are using large libraries that can really be a lot of wasted bandwidth. For example, Bootstrap is around 120k. Note the Google link you shared specifies the following (emphasis mine): If … Read more

How does Google’s Page Speed lossless image compression work?

If you’re really interested in the technical details, check out the source code: png_optimizer.cc jpeg_optimizer.cc webp_optimizer.cc For PNG files, they use OptiPNG with some trial-and-error approach // we use these four combinations because different images seem to benefit from // different parameters and this combination of 4 seems to work best for a large // … Read more

PageSpeed Insights 99/100 because of Google Analytics – How can I cache GA?

Well, if Google is cheating on you, you can cheat Google back: This is the user-agent for pageSpeed: “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.8 (KHTML, like Gecko; Google Page Speed Insights) Chrome/19.0.1084.36 Safari/536.8” You can insert a conditional to avoid serving the analytics script to PageSpeed: <?php if (!isset($_SERVER[‘HTTP_USER_AGENT’]) || stripos($_SERVER[‘HTTP_USER_AGENT’], ‘Speed Insights’) === false): ?> … Read more