Reduce the impact of third party code

What is third party code? 

Third-party code refers to elements that are included on your website but are not hosted by you. Instead, these resources are coming from a different domain/URL. 

Common examples of third-party code are: tracking scripts, advertising, YouTube videos, Google maps, webfonts, etc.

These externally hosted resources often impact the performance of your website.  Here Pagespeed measures this impact, and if they found it is high you will see this warning on your report:

If you expand this recommendation, you will see which scripts are triggering it:

What is the negative effect of third party code? 

These elements have to be downloaded from different servers, this can cause performance issues, as your server needs to connect to multiple servers to download them. 

These resources can contain scripts that block the execution of your page until they are downloaded, this prevents other tasks from being performed, severely affecting the user experience. 

Lighthouse calls this main-thread blocking
https://web.dev/third-party-summary/

Additionally, as you cannot control these resources because they are simply not hosted by you, it is common to see Browser caching and Compression related warnings on your reports, pointing to these scripts. 

You can read more about the impact of external resources in this doc: 
https://docs.wp-rocket.me/article/893-handling-external-resources

How can WP Rocket help?

While it's not possible for WP Rocket to optimize every external resource, our plugin has multiple features that can help here:

  • Minify CSS files and Minify/Combine JS - CSS and JavaScript files hosted on external domains will be processed and hosted on your own domain
  • Delay JavaScript execution - Can help reduce the negative impact that JavaScript has on the performance.
  • Optimize Google Fonts - While this does not host the fonts locally, it does improve the performance.
  • LazyLoad - This can improve the performance of externally hosted images. Videos and other external content loaded in iframes can benefit from the LazyLoad for iframes option.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.