How to Remove Google Analytics Code from Website
Need to remove the Google Analytics tracking code from your website? You're in the right place. Taking out an old tracking script might seem tricky, but it’s a straightforward process once you know where to look. This guide will walk you through exactly how to find, remove, and verify the removal of your Google Analytics code, whether it’s manually coded into your site, managed by a plugin, or deployed through Google Tag Manager.
Why Would You Need to Remove Google Analytics?
Before jumping into the "how," it's helpful to understand the "why." There are several common reasons for removing a GA tracking script. Knowing your reason can sometimes help you find the code faster and ensure you’re not accidentally removing something important.
- Upgrading to Google Analytics 4: Many website owners remove their old Universal Analytics (UA) code to replace it with the new GA4 tracking tag. Cleaning house prevents duplicate tracking, which can seriously inflate your user counts and skew your data.
- Switching to a Different Analytics Tool: You might be moving to a privacy-focused alternative like Fathom or Plausible, or a more product-focused tool. In this case, you’ll want to remove GA to eliminate redundant tracking.
- Website Redesign or Migration: During a major website overhaul, you may have added a new tracking code. It's smart to double-check that the old one from a previous theme or build was properly removed.
- Consolidating Tracking Methods: Perhaps your GA code was added manually in the past, but now you’re managing all your tracking tags through Google Tag Manager (GTM). You'd need to remove the manually placed code to avoid firing the same tag twice (once from the site’s HTML and once from GTM).
- Improving Website Performance: While the GA script is highly optimized, some developers remove all non-essential scripts to squeeze out every possible millisecond of loading time.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Step 1: First, Find Your Google Analytics Code
You can’t remove what you can’t find. The Google Analytics tracking code is a snippet of JavaScript that’s typically placed within the <code><,head>,</code> section of your website’s HTML. Depending on when you implemented it, it will look like one of two versions.
The newer version is the Global Site Tag (gtag.js), used for GA4 and more recent Universal Analytics properties. It looks something like this:
<!-- Global site tag (gtag.js) - Google Analytics -->
<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>The older version is for Universal Analytics (analytics.js). If your site has had analytics for a long time, you might find this one:
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r,i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date(),a=s.createElement(o),
m=s.getElementsByTagName(o)[0],a.async=1,a.src=g,m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'),
ga('create', 'UA-XXXXXXXXX-X', 'auto'),
ga('send', 'pageview'),
</script>
<!-- End Google Analytics -->Where to Look for the Code
The simplest way to check if the code is present on your live site is to use your browser’s "View Page Source" feature.
- Navigate to your website in a browser like Chrome or Firefox.
- Right-click anywhere on the page and select "View Page Source."
- A new tab will open with your site's HTML. Press
Ctrl + F(on Windows) orCmd + F(on Mac) to open the search bar. - Search for "gtag.js" or "analytics.js". If a snippet like one of the examples above appears, you’ve found it.
Now that you know what you're looking for, you can proceed to the removal method that best fits how your site is built.
Step 2: How to Remove the Google Analytics Code
The method you use depends entirely on how the code was added in the first place. Was it done manually? Through a plugin? Let's cover the most common scenarios.
Method 1: Removing from a Website’s HTML (Manual Removal)
This method applies to simple HTML websites or sites where you know a developer manually pasted the script into the theme files.
Heads up: Directly editing your website's code can be risky. One small mistake could take your site offline. Always, always make a backup of your files before you start editing.
- Access your website's files via an FTP client (like FileZilla) or your hosting provider's file manager.
- Locate the file that contains your site’s
<head>section. This is most often a file namedheader.php,head.html, orindex.html. - Open the file for editing.
- Look for the entire Google Analytics JavaScript snippet - from the opening
<script>tag to the closing</script>tag - and delete it. - Save the file and upload the changes to your server if you're using FTP.
Method 2: Removing from a Content Management System (CMS)
Most modern websites run on a CMS like WordPress or an e-commerce platform like Shopify. These systems have their own ways of managing tracking codes.
How to Remove GA from WordPress
In WordPress, analytics code is usually added in one of three ways: with a plugin, through the theme’s built-in options, or by directly editing files (less common).
- Through a Plugin: This is the easiest to fix. Many users install plugins like Site Kit by Google, MonsterInsights, or GA Google Analytics to handle tracking.
- Through Theme Options: Many themes provide a simple interface to add scripts.
How to Remove GA from Shopify
Shopify makes it easy to add Google Analytics, and just as easy to remove it.
- From your Shopify Admin dashboard, go to Online Store > Preferences.
- Scroll down to the "Google Analytics" section.
- If there is a code snippet pasted into the box, delete the entire block of code.
- Click "Save." The tracking script will be removed from your store’s theme immediately.
In some cases, the code might have been manually added to your Shopify theme. If you can't find it under Preferences, go to Online Store > Themes, click on Actions > Edit Code for your current theme, and look in the theme.liquid file. Be careful when editing this file, as it’s the backbone of your store’s layout.
How to Remove from Squarespace and Wix
Platforms like Squarespace and Wix centralize code snippets for easy management.
- On Squarespace: Go to Settings > Advanced > Code Injection. Look for your analytics script in the "Header" or "Footer" sections and delete it.
- On Wix: Go to your site dashboard and navigate to Marketing & SEO > Marketing Integrations. Find the Google Analytics connection and open it to remove or disconnect the integration.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Method 3: Removing from Google Tag Manager (GTM)
If your team uses Google Tag Manager to manage website scripts, you won't find the GA code in your site's files. GTM injects it dynamically. The only code you need on your site is the GTM container snippet. To remove Google Analytics, you edit your GTM container, not your website.
- Log in to your Google Tag Manager account and select the correct container for your website.
- In the left-hand menu, click on Tags.
- You'll see a list of all the tags firing on your site. Find your Google Analytics tag. It will likely be a "GA4 Configuration" or a "Universal Analytics" tag type.
- Click on the name of the tag to open it.
- In the top right corner, click the three-dot menu icon (⋮) and choose Pause (stops the tag from firing but keeps it in your container) or Delete (removes it permanently). For removal, "Delete" is the best option.
- CRITICAL NEXT STEP: Your change isn’t live yet! You must publish a new version of your container. Click the blue Submit button in the top right corner.
- Give your new version a descriptive name (e.g., "Removed Universal Analytics Tag") and click Publish. Once it’s published, GTM will no longer fire the Google Analytics tag on your site.
Step 3: Verify the Removal
After you’ve followed the steps, how do you know if it worked? You should always verify that the code is truly gone and no longer collecting data.
- Check the Page Source Again: Use the "View Page Source" method described earlier. Search again for "gtag.js" or "analytics.js". If your removal was successful, you shouldn’t find the script.
- Check Your GA Real-Time Report: Log in to your Google Analytics property. In the left-hand navigation, go to Reports > Real-Time. Open your website in a separate browser tab and navigate to a few pages. If the code is fully removed, you should see "0" users in the report. (Note: It may take a minute or two for data to stop flowing, so give it a short buffer.)
- Use Google Chrome's Developer Tools: This is a more technical approach. On your website, press F12 to open Developer Tools, click the "Network" tab, and then type "google-analytics" in the filter box. Refresh the page. If any requests are being sent to Google Analytics, they will show up here. An empty list means the tracking is gone.
Final Thoughts
Removing Google Analytics code is a task every website owner may face at some point. By first identifying how the code was implemented - manually, via a CMS plugin, or through GTM - you can follow a clean set of steps to remove it and then verify that all tracking has stopped.
Once your analytics tools are properly configured, making sense of all that data is the next major challenge. Instead of spending hours logging into different platforms and wrangling spreadsheets, we built Graphed to do the heavy lifting for you. We connect directly to your data sources like Google Analytics, Shopify, and various ad platforms, allowing you to build real-time dashboards and get instant insights just by asking questions in plain English. It's the fastest way to go from raw numbers to clear, actionable answers about what's working.
Related Articles
Facebook Ads for Salons: The Complete 2026 Strategy Guide
Learn how to run profitable Facebook ads for hair salons and beauty spas in 2026. This comprehensive guide covers targeting, ad creation, budgeting, and proven strategies to attract more clients.
Facebook Ads For Beauty Salons: The Complete 2026 Strategy Guide
Learn the proven Facebook ad strategies that successful beauty salons are using to attract new clients, increase repeat bookings, and grow their revenue in 2026.
Facebook Ads for Wedding Planners: The Complete 2026 Strategy Guide
Learn how to use Facebook ads to book more wedding planning clients in 2026. Complete guide covering targeting, budgets, retargeting, and conversion strategies.