Google’s Tag Assistant plugin is an indispensable tool for troubleshooting various Google tags like Google Analytics, Google AdWords, and Google Tag Manager; just install and navigate to your site to enable checks for nearly 300 possible issues. This post will describe how to fix of one of the most common issues reported by this plugin: “Same web property ID is tracked twice.”
Same web property ID is tracked twice simply means that you have the Google Analytics tracking script on your page more than once, with the same tracking ID. This means every page load fires off two or more instances of the GA code, and will cause metrics like page views and bounce rate to be incorrect. The most common reasons for this error are:
- GA is firing from within Google Tag Manager AND from GA code in a page template
- GA is firing from a plugin (e.g. a Magento or WordPress plugin) AND from GA code in a page template
- GTM contains multiple GA pageview tags
- Your page template contains old and new versions of the GA script at the same time
In short, Google Analytics provides a tracking code script that can be directly placed on your website. Alternately, you can fire Google Analytics from within Google Tag Manager or various plugins. To avoid double-counting, you should use only one of these implementation methods, and the tracking code should only be implemented once. For tips on determining where exactly you’ve double-implemented the GA tracking code, read on.
STEP #1. CHECK FOR MULTIPLE TAGS WITH THE GA DEBUGGER
This is the best all-around method to start with since it usually identifies the source of the issue. To start, install this Chrome add-on: Google Analytics Debugger. Once it’s installed, do the following:
- Click the add-on icon in the Chrome toolbar to ensure that it says “GA Debug: ON”
- Navigate to your site
- Open Developer Tools in Chrome (Press F12 on Windows or Cmd + Opt + I on Mac), and click the Console tab
- [optional] Type “pageview” into the filter bar at the top. This isn’t necessary, but it makes the output easier to read
- Check for multiple versions of the “send pageview” call to Google Analytics, as shown in the screenshot.
- If you see multiple calls with the same UA number, with and without the “gtm” preface, as in the above example, it means you have implemented GA both directly on the page and through GTM. In this case you need to remove your GA code from the page template so that you’re only firing GA from within Google Tag Manager. (While you could alternately remove your GA code from GTM so it’s only firing from the page template, generally it’s better to implement via GTM)
- If you see multiple calls with the same UA number, and they all have the “gtm” preface, it means you’ve set up multiple GA pageview tags from within GTM. This is an example of what that would look like:
Here you can see some calls prefaced with ‘gtm1’, and others prefaced with ‘gtm2’. In this case you need to log into your GTM account, navigate to Tags and remove all but one of your GA pageview tags.
- If you see multiple calls with the same UA number, and none of them have the ‘gtm’ preface, it means you have multiple GA pageview tags being fired from within your page template. Here’s an example of what that would look like:
Here you can see two lines that each say ga(“send”, “pageview”). There’s no ‘gtm’ preface so you know they’re not being set in Google Tag Manager.
Once you’ve completed the above, you should know whether the extra GA code is firing from the page template, from GTM, or some combination. If it’s firing from GTM only, you’re done here as you just need to log into your GTM account to remove the extra code. If the code is firing from the page template, read on for information on how to dig a little more to see exactly where the code is being injected onto the page.
STEP #2. CHECK THE PAGE SOURCE
The method from #1 will verify if you have multiple instances of the tracking code, but it won’t necessarily identify where this code is being fired from. To check this you will need to review each place where GA code can be inserted.
To identify where the code has been added, first check the page source. Since GA tracking code can be located in a separate JS file, this method isn’t always effective, but it’s worth checking since it’s fast and easy.
To check the page source, navigate to your site and click Ctrl-U (or right-click > View Page Source). Now hit CTRL-F and search for your account ID (‘UA-XXXX-X’). This may immediately locate the tracking code script(s) on your page.
If you have a custom site, you or your developers will need to find and remove these extra GA scripts from the page template files within your codebase. If you’re using a platform like WordPress or Magento, you may need to remove these scripts from your plugins or settings. Step #4 has some more info on that.
STEP #3. CHECK YOUR SITE’S SCRIPTS
If you didn’t find anything by reviewing the page source, you can search all the scripts for your site like this:
- Open Developer Tools in Chrome (Press F12 on Windows or Cmd + Opt + I on Mac)
- click Ctrl+Shift+F
- In the search box that appears, type in your UA tracking ID.
- In the bottom panel, a list of code snippets containing this tracking ID will appear. You can review each one to see the name of the file containing the snippet, and click each entry to be taken to the location in your code.
STEP #4. CHECK YOUR CMS SETTINGS AND PLUGINS
If you’re using a platform like WordPress or Magento, there are a few common places where GA code can be inserted. You will need to review each of these possible locations:
- Google Analytics plugins. In WordPress, navigate to Plugins > Installed Plugins and see if there are any Google Analytics plugins in the list.
- Google Tag Manager plugins. As above, navigate to WordPress > Plugins > Installed Plugins and see if there are any Google Tag Manager plugins in the list. If so, check the settings or log into your Tag Manager account to look for a GA tag.
- Theme page templates (usually located at WordPress > Appearance > Editor > header.php). Open up your theme’s files and search for GA or GTM code to see if it has been directly inserted here.
- Custom option within a theme. Some themes have an option to directly enter a GA tracking ID, usually located under WordPress > Appearance > Customize. Review your theme’s settings to see if this is the case.
- Built-in Google Analytics. Magento has a built-in Google Analytics integration. In Magento version 2.x, check if this has been enabled by navigating to Stores > Configuration > Sales > Google API
- Google Analytics Extensions. There’s no single place to view Magento modules/extensions, but often you can find them in the menu under Stores > Configuration. Look through this list for GA-related extensions:
- Google Tag Manager Extensions. Under Stores > Configuration, look for Google Tag Manager extensions.
If you see a Tag Manager extension, log into the Google Tag Manager account and check if any Google Analytics tags have been implemented within it.
In all cases, make sure you’re using ONE implementation method for Google Analytics, not multiple methods.
Still have any questions? Let me know below.