How to Find Duplicate Google Analytics Tracking Codes in WordPress

Do you have multiple instances of the Google Analytics tracking code installed on your site?

MonsterInsights installs the Google Analytics tracking code on your site, so if you’ve got multiple trackers installed, the other trackers might mess up your numbers.

In this article, we’ll show you the typical places the code may be hiding, so you can find the duplicate Google Analytics tracking codes and remove them to ensure you’re getting the best data.

Need to find out if you have multiple trackers on the same site? Then please see our guide: How to Detect if You Have Google Analytics Installed Multiple Times.

Typically, the other instance of the tracking code is hiding in one of the following places:

  • Your theme options or settings.
  • Your theme header.php.
  • Another plugin like “Insert Headers and Footers.”
  • A competitor plugin to MonsterInsights.

If your additional tracking codes are due to a YouTube video, Wistia video, Vimeo video, OptinMonster Form, or an iframe for an off-site form, there is no need to remove it.

Your Theme Options or Settings

Themes typically include a theme options page. These theme options pages may include a place to include header and footer scripts to further customize the theme, as well as add tracking like Google Analytics.

Every theme is slightly different, but you’ll first want to check the Theme Options for the Google Analytics code.

The code is typically hidden wherever your theme allows you to input header and footer scripts.

Header and footer scripts in your theme

Sometimes it’ll have a spot specifically for Google Analytics:

Google Analytics tracking code spot in theme

If you see any code mentioning Google Analytics there, and you’ve got MonsterInsights installed and activated, be sure to remove the duplicate tracking code.

Your Theme header

The next spot to check is your theme header.php.

Under Appearance » Editor » header.php look for some code mentioning Google Analytics:

Appearance - Editor - header.php

If you find it, and you have already enabled MonsterInsights, go ahead and remove this duplicate code.

A Plugin That Enables Inputting Header and Footer Scripts

Plugins such as “Insert Headers and Footers” enable you to add scripts to the <head> section of your site.

In this example, those settings can be found in:

Settings » Insert Headers and Footers.

You might have to look in the admin for a similar plugin.

Insert headers and footers

A competitor plugin to MonsterInsights

If you had previously installed a competitor plugin to MonsterInsights, it might be adding the analytics code a second time. Typically, these plugins contain the word “Google Analytics” in their title or description.

Step 1: You’ll want to find the plugin in Plugins » Installed Plugins.
Step 2: Deactivate plugin that’s adding the second Google Analytics tracking code, since MonsterInsights is taking care of this.

That’s it! Now you know the typical places duplicate Google Analytics tracking codes are hiding so that you can find and remove them. Ever wondered why different stats software such as Jetpack can show different visitor numbers? See our guide: Why Are Google Analytics Stats Different From Jetpack’s Stats?