Handling external resources
The problem with external content
These files, also known as resources, can be hosted in one of two ways:
- Internal resources are stored on your website's own domain
- External resources are not stored on your domain, but from third-party locations (e.g. Google, Facebook, Ad networks).
Externally hosted resources often impact the performance of your website significantly:
- They require additional DNS resolutions for each external domain used, which adds extra time.
- Some optimizations like browser caching and GZIP compression can only be applied to files hosted on your server. You cannot control resources that are hosted on other servers.
The more external resources loaded on your site, the greater the chance that your website will load slowly.
How can WP Rocket help?
It's not possible for WP Rocket to optimize every external resource completely, but the following features can help:
WP Rocket automatically applies the setting Optimize Google Fonts. While this does not host the fonts locally, it does improve the performance.
Read why we don't recommend hosting Google Fonts locally.
Depending on exactly how they're included in the page, many externally hosted images will benefit from the LazyLoad feature. Videos and other external content loaded in iframes will benefit from the iframes LazyLoad option.
Browser caching and compression
The most common warnings from speed testing tools (PageSpeed, Pingdom, GT Metrix etc) related to external resources are for browser caching and compression (GZIP or Brotli). These are impossible to satisfy since you simply cannot apply those optimizations for files that do not live on your own server. Please see the following guides for more information about how WP Rocket applies these:
In the examples below, taken from the Techcrunch site, the recommendations are impossible to resolve. All the domains referenced are 3rd parties: