Handling external resources

This article was built as a guide on how the external content affects the performance of a site, and how site owners can handle them.

The problem with external content

Every website contains images, CSS and JavaScript files  to create a pleasant and effective user experience.

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. 
  • In the case of external JavaScript, like ad scripts and social media scripts, these often introduce chains of other files loaded onto your site that you cannot control. These can be the most problematic for performance.

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 all external resources completely.

However, the following features can help optimize some of these assets:

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:

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.