All posts

How to remove Google Analytics from WordPress

Removing Google Analytics from a WordPress site takes about ten minutes. Removing it properly, without losing your history or leaving half a consent banner behind, takes a little longer. This is the whole list, in the order that avoids regret.

Before you remove anything: export

Once you disconnect, the historical data stops being convenient to reach, and Google has form for retiring properties and interfaces. Get the data out first.

At minimum, export monthly totals for the last two or three years: sessions, users, pageviews, and your top twenty or thirty pages. In GA4 that is Reports, then the share or export control on each report. CSV is fine.

Better, if your replacement supports importing: do that instead of a manual export. Honest Analytics imports from Google Analytics 4, and also from WP Statistics and Independent Analytics, so switching does not mean starting from zero. The import guide explains what comes across and why the totals will not match exactly.

Do this step first. It is the only one that is genuinely hard to undo.

Find every place the tag was added

This is where people leave a copy behind. Over the years the tag may have been added in several places at once, and removing one leaves the others firing.

Check all of these:

  • A plugin. Site Kit, MonsterInsights, GA4 plugins, or an all-in-one SEO plugin with an analytics field.
  • Theme options. Many themes have a “header scripts” or “tracking code” box in the customiser.
  • A code snippets plugin, where somebody once pasted a gtag block.
  • header.php or functions.php in the theme, usually from before there was a plugin for it. Check the child theme too.
  • Google Tag Manager. If GTM is installed, the GA4 tag may live inside the container rather than in your site at all, and removing things from WordPress will not touch it.
  • Your host or CDN. Some hosts inject scripts at the edge.

The reliable way to confirm you have found everything: load the site in a private window, open the browser’s network panel, and filter for requests to google-analytics.com, googletagmanager.com and analytics.google.com. If nothing appears on a page load, it is gone. Test a few different page types, including the home page, a post, and a page with a form.

If your banner exists mainly because of Google Analytics, revisit it once GA is gone. Do not simply delete it without checking, because it may also be covering other things.

Go through what is left on the site: embedded video, social embeds, ad tags, chat widgets, marketing pixels, font or map services loaded from a third party. Any one of those can keep a banner necessary on its own.

If analytics was the only reason, a cookieless replacement may remove the need for the analytics part of it. Honest Analytics is cookieless by default and designed not to require an analytics consent banner in its default configuration. Whether your site needs a banner overall depends on everything else it runs and where your visitors are, so that is a question for whoever advises you on it rather than something a plugin vendor can answer for you.

The cookieless page goes into more detail on what cookieless does and does not mean.

Clean up the account side

Removing the tag stops new data. It does not close anything down.

  • Delete the GA4 property, or at least the data stream, if you are certain you have what you need. There is a waiting period before deletion completes, which is your safety net.
  • Remove the site from Google Tag Manager if GTM was only there for analytics.
  • Revoke the site’s access in your Google account if a plugin connected via OAuth. Removing the plugin does not always revoke the grant.
  • Leave Search Console alone. It is a separate product, it does not track your visitors, and it is genuinely useful. Removing GA is not a reason to remove that.

Check what you broke

A few things quietly depend on the analytics tag:

  • Goal or conversion tracking used by ad campaigns. If you run Google Ads, conversions may be imported from GA4, and removing it stops that.
  • Dashboard widgets in WordPress that pull GA figures will now be empty or error.
  • Reports you send to somebody else. If a client or an advertiser gets a monthly figure, warn them the source is changing and that the number will move. It will, and it is better to say so in advance than to be asked afterwards.

Then check the new numbers honestly

Your replacement will report different figures, probably lower. That is expected and does not mean anything is broken: two analytics tools counting the same site always disagree, sometimes by a lot. Why your analytics numbers never match covers the reasons in detail.

Watch the trend rather than the total for the first month, and if you run a page cache, verify that cached page views are actually being counted before you trust anything. Caching breaks a lot of analytics setups and it is the most common reason a new install looks disappointing.

The short version

Export first. Find every copy of the tag, not just the obvious one. Reassess the banner rather than assuming. Tidy the account. Tell anyone who reads your numbers that the numbers are changing.

Moving from Google Analytics covers what changes in the reports themselves.