Articles on: Getting Started & Setup

Uninstalling Google Analytics from Wordpress

In order to install Bot Badger on your website, you must make sure that Google Analytics is not installed directly into your website.

Google Analytics can be integrated into a WordPress site in several ways.

First, we will go through each of the most common methods of installation and provide instructions on how to remove or uninstall Google Analytics from each.

Then, we'll share how to verify that you have removed Google Analytics successfully.

Step 1: Removing Google Analytics


There are multiple ways Google Analytics can be installed on a Wordpress site. If you know how yours is installed, jump to that option. If not, start at the top and work your way down until you hit the installation type used on your site.
1. Via a Plugin

Plugins like “MonsterInsights,” "Google Site Kit," “ExactMetrics,” “Analytify,” or “Google Analytics Dashboard for WP (GADWP)” are widely used for integrating Google Analytics.

If you Navigate to ‘Plugins’ on the left sidebar and scan the list and see one of these plugins, here's how to remove it:

Login to your WordPress dashboard.
Navigate to ‘Plugins’ on the left sidebar.
Find the Google Analytics plugin you are using.
Click ‘Deactivate.’
After the plugin is deactivated, you can click ‘Delete’ to remove it from your site completely.

2. Using a Theme’s Built-In Option

Some themes have a built-in field for Google Analytics code. This one's a little trickier to figure out, because each theme's configuration is different.

Here's how you can search your theme's configuration to hunt for a Google Analytics setting, and deactivate it if found:
Login to your WordPress dashboard.
Go to ‘Appearance’ > ‘Customize.’
Navigate to the theme settings/options. The exact location can vary based on the theme; it might be under ‘Theme Options,’ ‘Header,’ or ‘Footer’ settings.
Find the field where the Google Analytics code is pasted. It is typically a text area where you can paste scripts to be included in your site’s header or footer.
Delete the Google Analytics tracking code.
Click ‘Publish’ to save your changes.


Google Analytics can also be added by a developer by copying and pasting the tracking code directly into the header.php or footer.php file. The good news is that if you're careful, you don't need a developer to remove it.

> IMPORTANT NOTE: Directly editing theme files can be risky; always back up your site before making changes.

To search your theme's header.php and footer.php files for Google Analytics and remove it if found:
Login to your WordPress dashboard.
Navigate to ‘Appearance’ > ‘Theme Editor.’
Locate the header.php or footer.php from the list of theme files on the right-hand side.
Look for the Google Analytics script tag. It usually starts with <script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script> followed by a script initializing the gtag function with a tracking ID.
Carefully delete the script tags related to Google Analytics.
Click ‘Update File’ to save your changes.

4. Via Functions.php File

Developers sometimes add the Google Analytics code to the functions.php file of a theme. Unfortunately, if you are not comfortable with code, specifically PHP, you are probably best off working with your web developer to remove it.

> IMPORTANT NOTE: Directly editing theme files can be risky; always back up your site before making changes.

To remove Google Analytics from the functions.php file:
Login to your WordPress dashboard.
Navigate to ‘Appearance’ > ‘Theme Editor.’
Select the functions.php file from the list of theme files.
Search for the function that enqueues the Google Analytics script. It might be hooked to wp_head or wp_footer.
Remove the function and/or the action hook that adds the Google Analytics code.
Click ‘Update File’ to save the changes.

Step 2: Clear Your Cache


Most, but not all, Wordpress websites have a caching plugin installed to prevent the site from having to run all the code every time a page loads. Instead, it saves the results of running the code in something called a cache, and serves that when visitors hit the site.

Because of this, taking the steps above may not remove Google Analytics from your site.

There are several different caching plugins out there, but they all work roughly the same way. Let's cover the process for clearing the cache in three of the most popular ones. Your process will be very similar.

If You Have WP Rocket

Login to your WordPress dashboard.
Go to the top admin bar while logged into your dashboard. Hover over the “WP Rocket” menu.
Click on “Clear Cache.” This option will clear the entire cache created by WP Rocket.
WP Rocket should show a confirmation message at the top of the page indicating that the cache has been cleared.

If You Have W3 Total Cache

Login to your WordPress dashboard.
On the left sidebar, hover over the “Performance” menu and click on “Dashboard”
Inside the W3 Total Cache Dashboard, click on “empty all caches.”
A confirmation message will typically appear to let you know the caches have been successfully emptied.

If You Have WP Super Cache

Login to your WordPress dashboard.
On the left sidebar, click on “Settings” and then choose “WP Super Cache.”
In the WP Super Cache settings, go to the “Easy” tab.
Click on the “Delete Cache” button found in the “Delete Cached Pages” section.
WP Super Cache will display a message at the top of the page confirming that the cache has been deleted.

If You Have Another Caching Plugin

If you see references to "cache" in the menu, and the above three processes don't seem applicable to you:
Login to your WordPress dashboard.
Navigate to ‘Plugins’ on the left sidebar.
Look for any plugin with cache in the name or description.
Refer to their documentation or your favorite search engine to find out how to clear your cache.

Updated on: 04/12/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!