How To Remove Google Analytics Code From WordPress

When it comes to understanding the visitors of your website, Google Analytics is a highly useful tool. However, there may be instances where you need to remove the Google Analytics tracking code from your WordPress website. This guide will provide easy-to-follow steps to accomplish this.

Understanding Google Analytics Code

Before proceeding with the removal process, you need to understand what Google Analytics code is. It’s a snippet of JavaScript code that you need to install on your website. It collects and sends data to Google Analytics about your website’s visitor activities.

Steps to Remove Google Analytics Code

Step 1: Locate the Code

The first step in removing Google Analytics from your WordPress site is to locate where the tracking code has been installed. This could be in one of several places, depending on how it was added.

Step 2: Remove the Code From Theme Files

If you or a developer manually added the Google Analytics code to your theme files, it’s likely in your header.php or footer.php file. To remove it:

  1. Log in to your WordPress admin dashboard.
  2. Go to Appearance > Theme Editor.
  3. Select the theme file where the Google Analytics code is located (usually header.php or footer.php).
  4. Find the Google Analytics code. It will start with <script> and end with </script>.
  5. Delete the entire Google Analytics code and click Update File.

Here’s the Google Analytics code you should be looking for:

 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

 ga('create', 'UA-XXXXXXXXX-Y', 'auto');
 ga('send', 'pageview');

Step 3: Remove the Code From Plugins

If you added the Google Analytics tracking code via a plugin, such as Google Analytics by MonsterInsights or Insert Headers and Footers, you’d need to navigate to the settings page for that specific plugin and remove the code there.

Step 4: Clear Cache

Once you have removed the Google Analytics code, remember to clear your WordPress cache. This ensures that the changes will be applied immediately.


Removing Google Analytics from your WordPress site is a simple process, but it’s important to understand where the tracking code is installed before attempting to remove it. Always remember to clear your cache after making changes to ensure they take effect immediately.