I’ve received many requests on the WordPress support forums to create plugins to host certain files locally. I was thinking to create a plugin which would enable users to host anything locally, but since I already maintain multiple plugins and I have a live, I came up with a better idea. I think it will be easier for me and more informative for you, to show you how to host any file locally and keep it updated using cronjobs.
It’s a great performance boost for your website to host analytics.js locally. This helps you leverage browser caching, get a perfect 100/100 score on Pagespeed and Pingdom and raise conversion.
An average blog can locally host analytics.js without any fuss. If you’re in ecommerce (e.g. WooCommerce) things get tough, because hosting your Analytics file locally, usually means you can’t use most of Google’s Universal Analytics features.
Today I’m going to show you how you can easily host analytics.js locally, leverage browser caching and still profit from Universal Analytics’ advanced features.