How to Remove Google Analytics from WordPress
Need to remove the Google Analytics tracking code from your WordPress site? Whether you're switching to a new analytics platform, decluttering your site, or addressing privacy concerns, the process is usually straightforward. This guide will walk you through the three most common methods for finding and deleting the tracking script, ensuring it's completely gone from your site.
Why Would You Need to Remove Google Analytics?
Before jumping into the "how," it's helpful to understand the "why." There are several good reasons for removing the Google Analytics script from your WordPress site:
- Switching Analytics Tools: You might be migrating to Google Analytics 4 (and have added the new tag separately), or maybe you're trying a privacy-focused alternative like Fathom, Plausible, or Simple Analytics.
- Site Performance: Every external script, including the one for Google Analytics, adds to your site's load time. Removing unnecessary scripts can contribute to a faster, more responsive user experience.
- Privacy Compliance: With regulations like GDPR and CCPA, managing user data has become more complex. Some site owners opt for simpler, cookie-less solutions or remove tracking altogether to simplify their privacy policy and compliance process.
- Duplicate Tracking Codes: Sometimes, a new theme or plugin adds its own GA integration, and you end up with two tracking codes on the same page. This inflates your traffic numbers and skews your data, so you'll need to remove one of them.
- Staging or Development Sites: You often don't want to track internal activity on a development or staging server. Removing the script from these environments prevents junk data from polluting your official reports.
First Step: Locate Your Google Analytics Code
The trickiest part of removing Google Analytics is figuring out how it was added in the first place. WordPress offers multiple ways to inject code, and you need to find the right method to undo it. Here are the most common places the tracking script might be hiding.
Three common places for your tracking code are:
- A specific WordPress plugin: Tools like Site Kit by Google, MonsterInsights, or GA Google Analytics are designed specifically to add the tracking code for you. Header and footer script plugins like Insert Headers and Footers are another popular place.
- Your theme's settings panel: Many WordPress themes have a built-in feature to add tracking scripts. You can usually find this in the theme customizer or a dedicated "Theme Options" page.
- Directly in your theme's files: The code might have been manually added to a theme file, most commonly the header.php file. This method is more technical and less common for non-developers.
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.
A Quick Way to Check if the Code is Active
If you're not sure whether the script is live on your pages, you can easily check. Open 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 code. Press Ctrl + F (or Cmd + F on Mac) to open the search bar, and type in gtag.js or analytics.js. If your search finds a match, the script is present. You can also search for your specific tracking ID (e.g., "G-XXXXXXXXXX" or "UA-XXXXXXXXX-X").
Method 1: Removing Google Analytics via a Plugin
This is by far the most common and easiest scenario. If you used a plugin to install Google Analytics, you just need to disable that integration. Here’s a general rundown that applies to most analytics-focused plugins.
For Plugins like Site Kit, MonsterInsights, or Analytify:
- Navigate to your WordPress dashboard.
- Find the settings page for your specific analytics plugin (e.g., for Site Kit, it’s Site Kit > Settings > Connected Services).
- Look for the Google Analytics service connection. There should be an option to "Disconnect" or "Edit." Click this.
- Follow the steps to disconnect the Google Analytics module from your WordPress site. This prevents the plugin from adding the tracking code to your pages.
- Once disconnected, you can go to the Plugins > Installed Plugins page. Find the plugin, and click "Deactivate," followed by "Delete" if you no longer need it.
Note: Simply deactivating the plugin is usually enough to remove the tracking script. You don't have to delete it if you think you might use it again.
For Header/Footer Script Plugins:
- From your WordPress dashboard, go to Settings > Insert Headers and Footers (or wherever the plugin's settings are located).
- You'll likely see three boxes: Scripts in Header, Scripts in Body, and Scripts in Footer.
- Look for the block of code that starts with
<script>and contains "gtag.js" or "googletagmanager.com". - Highlight the entire code snippet, from
<script>to</script>, and delete it. - Click "Save" to apply the changes.
Method 2: Removing Google Analytics from Your Theme Options
Many modern WordPress themes want to make life easier by providing a dedicated spot for scripts. If your tracker was added this way, you'll need to remove it from the theme settings.
- Log into your WordPress admin dashboard.
- Navigate to Appearance > Customize. This will open the WordPress theme customizer.
- Look for a menu item with names like "Additional Scripts," "Advanced Settings," "Integrations," or "Header/Footer Code." The exact naming varies by theme.
- Click through these sections until you find a text box containing your Google Analytics tracking snippet.
- Select the entire script and delete it. Make sure you don't accidentally leave behind stray tags.
- Click the "Publish" or "Save" button to update your site.
If you can't find it in the Customizer, your theme might have its own options panel. Look for a menu item in your WordPress dashboard that matches your theme's name (e.g., "Divi," "Avada," "GeneratePress"). Then explore its settings for scripts or integrations.
Method 3: Manually Removing Google Analytics from Theme Files
This is the most hands-on approach and requires a bit of care. If a developer originally set up your site, this might be where they placed the code. A word of caution: making a mistake here can break your site.
Heads up: Before you proceed, always create a full backup of your website. If possible, use a child theme. If you edit your main (parent) theme's files directly, your changes will be erased when updating the theme.
- From your WordPress dashboard, go to Appearance > Theme File Editor.
- You may see a warning about editing theme files directly. Click "I understand" to continue.
- On the right side, find and open the file named header.php. This file loads on every page and is a common place for tracking codes.
- Carefully scan the file for the Google Analytics script. It will usually be located between
<head>and</head>. - Once found, highlight the entire code snippet and delete it.
- Click "Update File" to save your changes.
How to Verify the Tracking Code is Gone
After following one of the methods above, it's essential to confirm that your work was successful. You don't want to discover weeks later that a rogue script was still active.
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 1: Check the Page Source Again
This is the same trick we used earlier. Go to your live website in a new incognito window (to avoid caching issues). Right-click and "View Page Source," then search for gtag.js or your tracking ID. If you don't find it, you're all set.
Method 2: Use Your Browser's Developer Tools
- On your website, press F12 (or Ctrl+Shift+I on PC, Cmd+Option+I on Mac) to open Developer Tools.
- Click on the "Network" tab. This tab shows all the files and resources your site loads.
- In the filter box, type collect.
- Refresh your web page.
- If Google Analytics is active, you'll see requests sent to
google-analytics.com. If the list is empty after reload, the script has been removed.
Final Thoughts
Removing Google Analytics from WordPress is often as simple as flipping a switch in a plugin or deleting a code snippet from your theme options. The key is to correctly identify how the code was added, follow the appropriate steps, then double-check that the script is truly gone.
Freeing your site from old scripts improves site management and data clarity. Still, the real challenge is integrating data from different platforms. If you’re tired of logging into multiple dashboards, we can help. Instead of wrestling with reports, Graphed connects your data sources like Google Analytics, ad platforms, and CRM in seconds. Use plain English to build real-time dashboards and get instant insights.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.