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.
This post contains affiliate links which can be deemed not trustworthy by some adblockers. All affiliate links in this article resolve to relevant information on MonsterInsights.com, so warnings (if any) can be safely ignored. Enjoy!
Should I Host Analytics Locally?
The idea of locally hosting any file is simple: you copy it to your server, you change the link in your source code to the local copy and you’re done.
Using this technique with analytics.js might work for a day or two, but Google adds new features to Analytics a lot — most of them under the hood.
This means the code is updated a lot and unless you’re manually updating it on a daily basis — meanwhile neglecting your family and pets — your local copy will soon be outdated.
This is why Google advices against it — Because the code gets outdated. I don’t think they care about your relational status.
Leverage Browser Caching — Or why you should forget everything I just said and do it anyway
For you to have the advantage on your customers and make data-driven decisions, you need to be able to observe them. You need Google’s full suite of amazing tools. This is where Universal Analytics comes in.
Once you’ve enabled all of its features (such as enhanced ecommerce), it creates a lot of external requests. And if you’re a Pagespeed Insights user, you’ll die a little bit inside everytime you see this particular notice:
Leverage browser caching for the following cacheable resources:
External requests can be a performance killer. And a website that doesn’t perform, doesn’t convert any sales.
This isn’t rocket science.
Introducing Google Universal Analytics on Steroids
If you’ve been manually updating your local copy of analytics.js to maximize your site’s performance while still being able to use Universal Analytics, from now on you’ll have some extra time left to spend with your wife, kids or dog! They all deserve your attention — and damn you, Google for taking it away from them!
To spare you the headache of manually updating your analytic.js file or settling for a ~75/100 on Pagespeed, Pingdom and GTMetrix, I developed CAOS. A nifty plugin that downloads the file automatically and keeps it updated using WordPress’ built-in cron-schedule.
It features tons of options to optimize Google Analytics for your WordPress-website. And the best part is, since version 1.80 it’s fully compatible with Monster Insights’ Google Analytics for WordPress!
Why am I promoting their plugin instead of my own? Well, the reason is simple:
I’m after your money.
No, I’m kidding of course! No more jokes, I promise.
It’s their money I’m after.
I had my fingers crossed! But I’m done now, I swear.
The real reason I decided to fully integrate CAOS with Monster Insights’ plugin really is simple:
Monster Insights’ Google Analytics for WordPress features the most complete suite of options [affiliate link] available to WordPress to fully integrate Universal Analytics with your website and configure it to your needs. Even with WooCommerce!
It’s backed by an amazing team of talented WordPress developers. And to be honest, I could never give you the service and speedy updates they deliver.
However, as amazing and good looking as they might be — and they’re quite good looking [affiliate link], they can’t do everything right.
And this is where I come in.
Supercharge Monster Insights’ Google Analytics for WordPress with CAOS
Thanks to CAOS you can use all of Google Analytics’ amazing features without any loss of performance — and conversion.
To install CAOS login to your WordPress Admin-panel and…
- Go to Plugins > Add new,
- Search for ‘CAOS‘,
- Download the plugin by clicking Install,
- Press Activate to add the plugin’s options to your admin-screen.
If you prefer installing WordPress plugins manually, you can download CAOS as a .zip-archive and extract it to WordPress’ plugins-folder.
To fully integrate CAOS with Google Analytics for WordPress by Monster Insights you only have to check one box…
- Go to Settings > Optimize Analytics,
- Add a check to ‘Enable compatibility with Monster Insights?‘,
- Click ‘Save Changes‘.
Once you’ve checked the option you’ll notice most of the other options disappearing off the screen.
Don’t worry, it’s not because they don’t like you anymore. They just want to be somewhere where they can be useful!
After you’ve enabled the compatibility mode Google Analytics will be fully managed by Monster Insights’ plugin. CAOS will deliver the locally hosted analytics.js file and keep it updated regularly — like a boss!
Warning! Do not deactivate CAOS from the ‘Plugins’-screen, because that will also deactivate the update-script.
I use WooCommerce, can I leverage browser caching and host analytics.js locally?
Absolutely! It’s actually the main reason why I’ve chosen to integrate CAOS with Monster Insights’ plugin.
CAOS has been around for nearly three years now and all this time WooCommerce-users haven’t been able to host their analytics.js file locally and leverage browser caching. Mostly due to it’s complex tracking devices.
The Pro-version of Google Analytics for WordPress by Monster Insights is built for WooCommerce [affiliate link] and offers tracking solutions for what matters most to you and your enterprise:
- Universal Tracking,
- Form Conversion,
- Affiliate Links,
- Engagement Tracking,
- Ecommerce Tracking,
- Facebook Instant Articles,
- Enhanced Ecommerce,
- And much, much more…
Combining CAOS with the Pro-version of Google Analytics for WordPress by Monster Insights will give you the best of both worlds. Especially as a WooCommerce-user!
Host analytics.js locally to leverage browser caching and use Universal analytics to get the performance and the advantage you need to raise your sales. Click the image below to find a package that suits your needs! [affiliate link]
17 thoughts on “Leverage Browser Caching by Hosting Analytics Locally with Monster Insights’ WordPress Plugin”
I installed this plugin and it increased by pagesped score by 2% which is great but Monsterinsights reports is disabled!
I’m happy it increased your Pagespeed score! It’s strange, however. CAOS doesn’t change anything to the way Montster Insights’ works, except the source where it takes the analytics.js from.
Could you elaborate? Then I’ll try to reproduce the issue myself.
I’m happy you managed to resolve this issue by contacting Monster Insights and that CAOS wasn’t the culprit. 🙂
But MonsterInsight was working well anyway until I installed CAOS.
I’ve sent you an e-mail.
I am getting this error:
Serve resources from a consistent URL
The following resources have identical contents, but are served from different URLs. Serve these resources from a consistent URL to save 1 request(s) and 42.7KiB.
Do you know what could be the problem?
Your site is still requesting it from Google’s servers. You did enable compatibility mode with Monster Insights within CAOS’ settings?
If so, then another plugin or somewhere in your theme, the snippet is added.
And over six months later I got same thing, and I enabled compatibility mode. It was defenetly by Monster Insights.
WooCommerce has their own (free) google analytics plugin available. Can I use this with CAOS? Will the monster checkbox have the same effect (I am guessing no)? Can I point the WC plugin to the local JS file?
Thanks for the great plugins and for answering comments!
I have gotten this question many times, and after reading yours, I looked into it again. At this moment I haven’t found a foolproof way to implement a compatibility mode with WooCommerce’s own Google analytics integration plugin into CAOS. Sorry 🙁
I just found out WooCommerce has their own Github repository. So I added a pull request with the required changes. If they approve it, that would mean I could make CAOS compatible! https://github.com/woocommerce/woocommerce-google-analytics-integration/pull/140