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
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:
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/Combine CSS and Minify/Combine JS From WP Rocket version 3.7, CSS and JS files hosted on external domains will be processed and hosted on your own domain
- Optimize Google Fonts. While this does not host the fonts locally, it does improve the performance.
- LazyLoad This will improve the performance of externally hosted images. Videos and other external content loaded in iframes will benefit from the LazyLoad for iframes option.