Save the Google Analytics file (gtag.js / analytics.js) locally to be able to cache it for longer than 2 hours for a better PageSpeed score!
As of April 2026, Cache External Scripts is a WordPress cache plugin with 1.0K+ active installations and a 5/5 rating from 25 reviews. It has been downloaded 31K+ times in total. Requires WordPress 3.0.1+ and PHP false+. Available on WordPress.org since 2015. Last updated 6 years ago — may have compatibility concerns. Downloads are up 20% this week. Top alternative: WP-Optimize – Cache, Compress images….
Often when trying to optimize the Google Pagespeed score, there is one script which still causing the ‘Leverage browser caching’ rule popping up: Google’s own gtag.js and/or analytics.js file…
With this plugin you will be able to cache this file on your local server and enable browser caching for longer than 2 hours. The plugin will check every day if there is a newer version of the file to keep the cache up to date.
Very Good plugin
Would be great to also support facebook pixel code (at some point) 🙂
I was a bit concerned about this plugin and its conflict with W3, but it gets the job done perfectly! thanks guys
Great little plugin, works very well
could do with a few other things being cached – google maps?
I love this
| WordPress | 3.0.1+ requiredTested up to 5.2.24 |
| PHP | false+ required |
Plugin data sourced from WordPress.org. Analysis and metrics by PluginSift.