Improve your Google Pagespeed Insights score by delaying the execution of below-the-fold third-party functionality such as commenting scripts, help bots, reCAPTCHA, Share This, Cookie Scripts, and more.
Async and Defer can really make a massive difference in improving Pagespeed Insights score, to go that extra mile to achieve a higher Pagespeed Insights score (PSI), try this.
Delay the JS script execution
This script delays "third-party-script.js" for 5000 milliseconds, allowing plenty of time for all the async and defer scripts to load.
Load after everything else
This script will fire after everything else has loaded.
And lastly, the jQuery DomReady snippet.
Either of these options will help to improve your Google Pagespeed Insights score. I cannot confirm though if they will improve your Core Web Vitals. I need to gather more data. I will update this post accordingly.
Async and Defer can really make a massive difference in improving Pagespeed Insights score, to go that extra mile to achieve a higher Pagespeed Insights score (PSI), try this.
Delay the JS script execution
Code:
<script>
setTimeout(function(){
loadJs("third-party-script.js");
},5000);
</script>
This script delays "third-party-script.js" for 5000 milliseconds, allowing plenty of time for all the async and defer scripts to load.
Load after everything else
Code:
<script>
window.onload = function() {
loadJs("third-party-script.js");
}
</script>
This script will fire after everything else has loaded.
And lastly, the jQuery DomReady snippet.
Code:
<script>
define(['jquery','domReady!'], function($) {
// Your Code
}(jQuery)
);
</script>
Either of these options will help to improve your Google Pagespeed Insights score. I cannot confirm though if they will improve your Core Web Vitals. I need to gather more data. I will update this post accordingly.