How To Host Google Analytics Locally In WordPress

Leverage Brower Caching Google Analytics

If you’re using Google Analytics on your WordPress site, you might see a leverage browser caching issue in your GTmetrix report.

Hosting your Google Analytics tracking code locally should fix this. There are many plugins to host analytics locally, which is as easy as copying and pasting your UA number into the plugin.

You have a few plugin choices: I recommend WP Rocket’s Google Tracking add-on if you’re already use it as your cache plugin. Otherwise, CAOS | Host Google Analytics Locally works.

Backup Your Google Analytics Data: it’s a good idea to backup your Google Analytics data before hosting your tracking code locally. To do this, login to your Google Analytics account, navigate to a report, click Export (top right), then click the file type you want it exported to.

 

1. CAOS | Host Google Analytics Locally

CAOS has great reviews and it’s sole purpose is to host Google Analytics locally.

CAOS-Analytics

In the CAOS settings, copy/paste your Google Analytics Tracking ID into the plugin. Next, choose to always allow tracking or when cookies are set, not set, or when they have a value.

CAOS Analytics Settings

In the advanced settings, the main things you want to look at are:

CAOS Analytics Settings

 

2. WP Rocket

To host analytics locally in WP Rocket, go to the Add-ons tab and enable Google Tracking.

WP Rocket Local Analytics

[…]

 



This article was written by Tom Dupuis and originally published on Tom Dupuis.

Disclosure: Some of the links in this post are "affiliate links." This means if you click on the link and purchase the product, We may receive an affiliate commission.

Leave a Comment

You have to agree to the comment policy.

Show Your ❤️ Love! Like Us
Scroll to Top