Handling external resources
Speaking of source location, we can separate 2 types of files (here also called “resources”):
- Internal resources stored on the same server where the website is;
- External resources that get loaded from third-party locations (e.g. Google, Facebook, Ad networks).
WP Rocket is a very powerful tool to optimize internal resources in order to make your site faster. However, when it comes to external resources, neither WP Rocket, nor any other caching plugin have access to control the behavior of those files. (For example, only Google could optimize the performance of files loaded from a Google server; only Facebook for those loaded from Facebook’s server, etc.)
Note: Although WP Rocket cannot control these resources, they often impact the performance of your website significantly. The more resources of this type get loaded on your site, the greater chances are your website will load slowly. Ads scripts are usually the most problematic ones.
A good example that illustrates the impossibility to control these resources can be the “Leverage Browser Caching” and “Enable Compression” suggestions from tools such as Google PageSpeed Insights.
As you can see, Google PageSpeed Insight recommends to optimize external files and their expiration rules, while there is no mention for files from the site we’re really testing (here: https://wp-rocket.me). No “complaints” about assets stored to our server—great result!
Note: Activate the Google Tracking Add-on to host Analytics and Tag Manager files locally!
WP Rocket will automatically add the optimal rules for browser caching and GZIP compression in the .htaccess file. (Note that on NGINX you need to apply them manually.)
However, WP Rocket cannot access different servers and apply changes to their configurations, nor could any other plugin—in fact, it would be a huge security risk and a great mess if it was possible.