How to Reduce the impact of third-party code in page speed insight
If you are using Blogger or Wordpress and tested your site in the page speed insight tool then you may come across an error called to reduce the impact of third-party codes.
This is a common page speed error that occurs due to third-party scripts used on the website. Third-party scripts like Adsense, Google Analytics, Facebook pixel, etc caused the maximum impact on page speed.
Those types of scripts will block the main thread and load the page much slower. Due to the heavy script, the browser will take a longer time to render the page and it will impact your core web vitals score.
So, you can either lazyload the script or delay the script to fix this issue.
I have already made several tutorials on Lazyload Adsense, Lazyload Google analytics, and lazyload images.
In this article, I will show you how you can delay an external script like Adsense and solve the "reduce the impact of third party codes" error in page speed insight, and speed up your website loading speed.
How does third-party code affect page performance?
Whenever a page is loaded in the browser, it needs to download and parse the HTML code line-by-line. In this process, it may come across third-party scripts like Adsense, Analytics, etc that are likely to block the main thread.
It also helps us pass the core web vitals which is very important for SEO.
Here, note that you can change the delay time in milliseconds. Here 5000ms means 5 sec. So, if you want to delay the script for 3 seconds then change it to 3000
Now if you want to delay the external script like Adsense then you need to remove all previous js code and replace it with the given codes. Otherwise, if the same js code is present before this script then it will not work
If you are using Blogger then you can paste this code into your footer or header section by going to the Theme > Edit HTML.
If you are using wordpress then you can paste the script in the footer section by going to Appearance -- Theme editor -- footer.php and find the closing </body> tag. You can also use some code manager plugin to insert the code in the header or footer section.
Performance plugin like perfmatters also gives you the functionality to delay any particular script in wordpress. You can check the complete review and setup of the perfmatters plugin here.
I hope this article help you solve reduce the impact of third-party codes on Blogger and Wordpress website. I recommend you to follow the page speed improvement playlist on YouTube to solve your issues.
If you have any doubts then you can ask me in our Telegram group or over Email. Thank You.
Note: If you want me to speed up your Blogger or Wordpress website then you can hire me on Fiverr or contact me directly on social media platforms.