How to Remove Google Analytics From Your Site 2026

Removing the tag from one file rarely removes it from the site. Inventory every loader, export your history, take it out in order, and verify.

By Null Agency · Updated November 4, 2026 · Written for site owners switching away from Google Analytics

TL;DR — removing Google Analytics is an inventory job, not a delete key

The hard part is finding every place the tag lives. A typical site loads Google Analytics from more than one spot: a hard-coded snippet, a tag manager container, a CMS plugin, a theme option, a consent tool that fires it. Remove only one and the tracker keeps running from another, with the consent banner still on screen.

The numbered how-to below takes most sites under an hour. Sites with a tag manager and several plugins should plan for two.

Step zero: inventory every place the tag can live

Before you touch anything, list where Google Analytics is loaded. The tracker is the same library whichever way it arrives, so the goal is to find every loader. Open your site in a private window, open DevTools, switch to the Network tab and filter for googletagmanager, google-analytics and collect. Whatever shows up is your evidence; the table below tells you where to look for the source.

Where it hidesWhat it looks likeHow to find it
Hard-coded snippetA gtag.js script in the page head plus a gtag('config', 'G-…') callView source and search for gtag; search the theme or layout files
Tag manager containerA GTM-… snippet in the head and a noscript iframe after the body tagSearch for googletagmanager.com/gtm.js; then open the container and look at its tags and triggers
CMS pluginA Google Analytics, Site Kit or analytics-dashboard plugin with a measurement ID saved in settingsThe plugin list in your CMS admin; search plugin settings for G-
Theme or builder optionA "tracking code" or "Google Analytics ID" field in theme settings or a site-builder panelTheme customizer, site-builder integrations screen
Consent toolA banner that loads the tag after a visitor acceptsThe consent platform's script list or category settings
Server-side taggingRequests to your own subdomain that forward to GoogleNetwork tab requests to a first-party tagging host; your tag manager's server container
Other productsAds conversions, remarketing audiences or reports that read from the same propertyThe property's linked-products settings in Google's admin

Write the list down with the owner of each item. On a site with an agency or several developers, the container and the plugin are often managed by different people.

Export what you need before you remove anything

Removing the tag does not delete your history, but it stops adding to it, and the property's data is subject to Google's retention settings. Decide now what you want to keep and export it while the property is still receiving data. Our guide to exporting your GA4 history covers the options in detail; the short version is below.

Nothing from GA4 carries over into GhostMetrics automatically; the new tool starts counting from the day you install it. That is why running both for a couple of weeks, as described in our migration guide, is worth it if you need a continuous baseline.

How to remove Google Analytics, step by step

  1. Record a baseline. Screenshot the last 28 days of pageviews, top pages and top sources in your current tool. You will compare orders of magnitude later.
  2. Remove it from the tag manager first. If the tag fires from a container, pause or delete the Google Analytics tag (the "Google tag" or GA4 configuration tag), plus any GA4 event tags that depend on it. Publish a new container version with a clear name such as "Remove GA4". Leave the container itself installed until you have checked what else it runs.
  3. Deactivate plugins and theme fields. Deactivate the analytics plugin, then delete it once you confirm nothing else needs it. Clear any "tracking ID" field in theme or builder settings. Do the removal in a staging copy if you have one.
  4. Delete hard-coded snippets. Search your templates for the lines below and remove the whole block, not only the config call.
  5. Remove server-side tags. If you forward events through a first-party tagging host, disable the Google Analytics client and tags there too, or the server keeps sending data for any request that still arrives.
  6. Take down the consent banner if analytics was its only job. If the banner only existed to gate Google Analytics, remove it. If it also gates ads, embeds or other cookie-setting scripts, keep it and take Google Analytics out of its categories. See the consent section below.
  7. Purge caches. Clear your CMS cache, your CDN cache and any page-builder cache, or visitors will keep receiving the old head.
  8. Verify in DevTools using the table later on this page.

The blocks to search for in templates look like this:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

On a WordPress site that adds the tag from a theme function, the hook to delete or comment out is the one that prints into wp_head:

// functions.php - remove or comment out the hook that prints the tag
// add_action('wp_head', 'my_theme_print_gtag');

Static sites built with Hugo, Jekyll or Astro usually keep the snippet in a head partial or base layout; search the repository for gtag and googletagmanager, remove the matches, rebuild and redeploy.

The consent banner: what changes and what does not

Cookie-based analytics generally requires consent in the EU and UK, which is why most Google Analytics installs come with a banner. Once Google Analytics is gone and nothing else on the page sets non-essential cookies, the reason for the banner may go with it. That depends on everything else the site loads, so audit before you delete.

GhostMetrics sets no cookies and does not use localStorage; its only browser storage is a per-tab counter and the session's first-touch UTM values in sessionStorage. If analytics was the sole reason for your banner, you may be able to drop it after the swap. If it was not, the banner stays.

What happens to the GA4 property afterwards

Removing the tag from your site stops new data from arriving. It does not delete the property, your reports or your linked products. The property stays in your Google account until you delete it yourself, and data it already holds follows Google's retention settings. Check the current Google Analytics documentation for how property deletion works and whether a deleted property can be restored, because Google changes the details and this page does not quote timelines.

A sensible sequence is: remove the tag, wait until your exports are verified against the originals, unlink anything that still points at the property, and only then decide whether to delete it. Keeping an idle property costs nothing and keeps your reports readable. If the property has Google Ads linked, move any conversion imports to a different source before removal, or those imports stop.

Mistakes that leave Google Analytics running

Most failed removals come from the same handful of oversights. Each one is easy to check once you know it exists.

Run the DevTools checks on at least one page of each type: the home page, a blog post, a checkout or contact page and any page built on a different template. A single template that still loads the tag is enough to keep collecting data, and it often hides on the pages you visit least.

Install the replacement and verify the result

With Google Analytics gone, add the replacement. GhostMetrics is one tag in the head, on any host, with no plugin and no build step:

<script defer src="https://ghostmetrics.nullagency.io/gm.js" data-site="YOUR-SITE-ID"></script>

Create the site in the dashboard to get your site ID. Static-site and framework placement is covered in our guide to adding analytics to a static site, and WordPress owners can follow analytics on WordPress without Google. Then confirm the whole change worked:

Check in DevToolsExpected after removal
Network tab, filter googletagmanagerNo requests, unless you kept a tag manager container for other tags
Network tab, filter collectNo requests to Google's analytics endpoints; one request to the GhostMetrics endpoint on each page view
Application, CookiesNo _ga or _ga_ cookies on a fresh private window
ConsoleNo errors from leftover gtag(...) calls; if you see "gtag is not defined", a template still calls it
View sourceNo gtag, G- measurement IDs or GTM- snippets in the head or body
GhostMetrics dashboardYour own visit appears under Live within a few minutes

If your own visit does not show up, check that Global Privacy Control or Do Not Track is not enabled in your browser, since the tracker honors both and collects nothing. Our guide to testing your analytics install walks through the other common causes. After a day of traffic, compare orders of magnitude with the baseline you recorded in step one; the totals will not match exactly, because tools differ on bot filtering, blockers and consent. If you are still choosing a replacement, our GA4 alternatives comparison lays out the options.

Replace it with one script tag: GhostMetrics

No cookies$0 forever1 site free$9.99/mo flat Pro

GhostMetrics is cookieless web analytics by Null Agency, and we use it on this site. No cookies, no localStorage, no stored IP addresses. The free plan is free forever: one site, unlimited pageviews, a real-time dashboard, every view and full history. Raw event export as CSV or JSON is available on every plan, including free.

Managing several sites, or want a public shareable dashboard? Pro is $9.99/mo flat with unlimited pageviews and unlimited websites (fair-use ceiling of 250), with a 30-day free trial. A card starts the trial, nothing is charged for 30 days, and you can cancel anytime. It does not replace Google Ads attribution, audiences or ecommerce funnels, so keep Google's tools if those are essential to you.

Start free — no card See the live demo

FAQ

Does removing the Google Analytics tag delete my data?
No. Removing the tag stops new data from arriving, but the property and its existing reports stay in your Google account until you delete the property yourself. Check Google's current documentation for retention and deletion rules before you decide.
How do I know every Google Analytics tag is gone?
Load the site in a private window, open DevTools, and filter the Network tab for googletagmanager and collect. Check Application, then Cookies, for _ga cookies, and search the page source for gtag and G- measurement IDs. A clean site shows none of these.
Can I remove the cookie banner after removing Google Analytics?
Only if nothing else on the site sets non-essential cookies. Ads, embedded video, chat and social widgets set their own. Audit the cookies first, and keep the banner for anything that remains. This is not legal advice.
Should I delete the GA4 property after removing the tag?
Not immediately. Export what you need, verify the exports, unlink any products such as Google Ads, and then decide. An idle property costs nothing, and deletion rules are in Google's current documentation.
What do I lose by switching from Google Analytics to GhostMetrics?
Google Ads attribution, audiences, ecommerce funnels and multi-session user tracking do not exist in GhostMetrics. You gain a cookieless tool with a free plan for one site and raw export on every plan.

Keep reading

Export Your GA4 History

Save your data before retention limits apply

Migrate to GhostMetrics

Run both tools in parallel, then switch

All Analytics Guides

Every cookieless analytics guide in one place

GhostMetrics Live Demo

The real dashboard, live data

Disclosure: GhostMetrics is built by Null Agency and we use it on this site, so we are not a neutral party about our own product. Google's products and terms change; check Google's current documentation before deleting any property or relying on a retention period.