Everything You Need to Know About Finding & Fixing Duplicated Google Analytics Tracking Codes
You can’t call yourself a data-savvy marketer if you haven’t opened your Google Analytics account now and realized that half of the day flew by in a heartbeat.
This is especially true when you’ve just launched that super-exciting marketing tactic and you constantly check session numbers, conversions, and overall engagement. The last thing you worry about throughout that frenzy is the possibility of that data not being 100% accurate.
Yet, somehow, from our experience, this happens way more often than you can imagine.
We’ve recently had a client who had duplicated analytics tracking code on their website FOR 2 ENTIRE YEARS!
When I discovered this, the first question that came to mind was: how can I know the metrics affected by the duplicated code?
Trying to find comprehensive information about this online led me to a dead-end. So, I did what any data-obsessed marketer would do. I tested, debugged, and deduced some of the negative effects by simply gathering data both with and without the duplicated code.
Comparing the results led me to the answers I needed.
Thanks to my experience, I now know how you can make sense of paste data, which are the metrics you can still count on and which ones you can’t, and why it all happens.
The purpose of this post is to share this information so you don’t have to go through the same tedious process I went through. In the next few minutes you’re about to discover:
- How you can end up with duplicated code.
- How to check if your tracking code snippet is duplicated
- How to assess the damage and identify reliable data.
How Do You End up With Duplicated Code?
As you may know, there are several ways to implement tracking:
- By copying and pasting the latest version of the analytics code into the section of your website’s code. You can find this code inside your Google Analytics Account.
- By implementing Google Analytics through Google Tag Manager.
- By implementing Google Analytics through a plug-in.
Any combination of the 2 implementation methods (as shown in the image below) will prove fatal for some of your metrics.
Plus, there’s one other thing you need to watch out for: Google’s own tracking code updates.
Once every few years, Google updates its tracking code. However, it turns out it’s not clever enough to automatically delete the old one. As a result, you can end up with two hardcoded GA tracking codes in the websites, each filling up your reports with data.
We’ll go through the process of finding each code and how to eliminate one a little bit later. For now, let’s make sure your code is indeed duplicated.
How to Check if Your Tracking Code Snippet Is Duplicated?
There are at least 3 ways you can solve this dilemma. We’re going to go through each of them and their specific use cases
1. Google Tag Assistant
This is a tool of many talents. If you’re not using it yet, you can download it here. If we had to choose one method to figure out whether or not the code is duplicated, this would be it. Why? Well, it’s fast and it’s accurate. What more can you wish for?
To use it, stary the recording and load the page you want to check. If your code is indeed duplicated, the results will look like the image below.
If you click on the yellow error signal, you’ll get:
The error ‘Same web property ID is tracked twice’ is the one to watch out for.
The ‘Non-standard implementation’ alert is not an error per se from your end. It’s Google’s way of telling you your GTM has more than 6 numbers. So, feel free to ignore it. Google will probably fix it soon enough.
2. UTM parameters
For this second method to work, you must first create a link with a unique query parameter. Let’s say we want to create this one -> umt_medium=duplicatedcode.
The next step is to access this link and visit a few pages on your website.
Important: Don’t reload any page and don’t go back to any previous page! Make sure you only view each page once. Once you’re done, hit the ‘X’ button so you don’t duplicate the page views yourself.
You’ll have to wait 24 hours before the data shows up in your reports. Once those hours have passed, create a segment in analytics including the only session that had the UTM parameter mentioned above.
Apply this segment to the All Pages report. If your code is not duplicated, the report will look like the one you can see below.
If there’s more than one page view for any of the pages you visited… well, Houston, we have a problem!
3. GA Checker
As opposed to UTM Parameters, this tool tells you if your tracking code is duplicated if you simply add your website’s address
Yes, it’s that easy. There’s a catch, however! The tool treats GTM separately. This means it won’t work if you’re tracking once through GTM and once through any other method. Bummer, we know…
How to Do Damage Control and Identify Reliable Data
At the end of the day, no matter how you ended up with duplicated codes, the end result is the same: significantly skewed data.
Which doesn’t just sound bad – it IS bad.
There are a few metrics you can stil rely on though. Here’s how we found out about them.
While we were handling a project, we gathered some data for eight days.
During the first four days, there was just the one piece of code. (The way God always intended it to be!)
However, for the last 4 days, the code was duplicated. (May God have mercy on your data!)
Let’s analyze and see what happened.
Before we get to it, I’d just like to emphasize that I’m 100% sure the data was not caused by traffic fluctuations. Here’s a screenshot of the sessions throughout the whole period:
As you can see, the graph looks fine. Now let’s dig a little deeper.
The first step would be to get an overview. So, we go to Behavior -> Overview.
Notice that not-so-tiny bump in page views? And how about that unrealistic drop in bounce rate and exit rate?
Yeah, they’re phonier than a three dollar bill. Let’s understand why.
Check #1 – Pageviews
Google defines a page view (also called page view hit or page tracking hit) as an instance of a page being loaded (or reloaded) in a browser.
The problem? Each one of your code snippets sends Google a hit each time a page is loaded (or reloaded).
As a result, all your reports will include a highly inflated number of page views
Hint: Never create segments with Page Depth as you can no longer trust it.
Nor can you look at reports with this dimension.
Check #2 – Bounce Rate
Google defines bounce rate as single-page sessions divided by the total number of sessions. In other words, it’s the percentage of all your website’s sessions where users viewed only a single page and triggered a single request to the Analytics server.
The problem here is that since your code sends 2 page-view request (see Tag Assistant screenshot), GA believes the user made 2 separate actions. As a result, it’s being discarded as a bounce.
Obviously, because of this you’ll get an unreaslistally low bounce rate (close to zero).
Check #3 – Exit Rate
Going back to Google’s textbook definition, the exit rate is the number of exits divided by the number of page views for a page or a set of pages.
If your code is duplicated, the number of exits may remain the same while the number of page views will be doubled. That’s because eah snippet is separately sending a unique page view.
Here’s why you’ll end up with an artificially lowered exit rate.
Check #4 – Pages/Session
The Pages/Session indicator represents the average number of pages viewed during a session. Repeated views of a single page are also counted.
I’m going go ahead and just assume that you probably put the pieces together after reading the bolded sentence above.
Check #5 – Destination Goals
Do not panic!
Yes, Google registers 2 hits for any destination goal.
However, it is also smart enough to only register one goal per session. This means that if you have a destination goal set for a Thank You page, no matter how many times you refresh it (or how many page views you send) within the same session, Google will only register it once in your reports.
How do I fix it?
Captain Obvious to the rescue here – but one of the codes must go.
Pro Tip: If ou have a choice between GTM and anything else, we strongly recommend sticking with GTM. There are so many reasons why GTM is better, but now’s not the time to get into that.
Before deciding on which code to scrap, the first step is to discover which combination applies to you.
Here’s how you can do this.
- Open developer Tools – Press CTRL+SHIFT+I if you have Windows or CMD+I if you’re using a Mac
- Look for your GA tracking ID (UA-XXXXXXXX-X) – Press CTRL+F or CMD+F on Mac
- Did it appear twice? Examine them! (If not, move to the next step).
- The two snippets are different versions of GA. Delete the older version. Hint: The global site tag is the most recent version.
- One of the code snippets is inserted through a plug-in. It’s up to you to decide which one to keep. For example, if you’re using the same plug-in for e-commerce also, it’s probably best to stick with the plug-in.
- You only found it once. This means the other one is most likely inserted through GTM.
- Go into your GTM account and check for a page view tag with the same tracking ID.
- Now decide which one to eliminate. (As previously mentioned, we recommend sticking to GTM and moving all your tracking to it.)
As for how to actually delete the extra code snippet, it’s virtually impossible to find a step-by-step guide to work for all the different type of websites. I can, however, give you a walkthrough on how to remove the code from a WordPress site.
However, our recommandation, especially if you lack technical knowledge, is to ask a developer’s help.
How to Delete the Extra Code Snippet from a WordPress site
#1. How to Check for a Plugin or Remove It if Necessary
The first thing to do is to go to your WordPress dashboard, and click on Plugins. Try to see if you can spot any GA or GTM plugins.
Before removing a plugin, you’ll first need to deactivate it. Once you do this, a delete button will appear.
Here’s a screenshot of the most popular GA plugins.
#2. How to remove hardcoded GA
Go to Appearance->Editor->Header File and delete it. If you can’t find the code there, make sure to check out all the other Theme Files. For instance, I once foud it in a client’s footer.php file.
#3. If you do decide to remove the GTM code (which I don’t recommend) here’s how to do it:
GTM can either be installed through a plugin or hardcoded into the website. Regardless of how it got there, you can remove it by following the same instructions mentioned above for GA.
If, however, you don’t want to remove the entire GTM code (if you’re using it for Hotjar or other purposes), you can simply remove any universal analytics tags from your GTM account.
Can Damaged Data Be Corrected and Recovered?
I’ll be honest wI’ll be honest with you: nope!
Once analytics registers data, there’s no way to of changing it. I know. It’s sad. Trust me, I’ve spilled my fair share of tears over it.
If you can pinpoint the exact moment the code got duplicated, you can put annotations for that specific timeframe. This way you’ll know not to use the data in your reports (at least not if you’re planning on checking any of the metrics mentioned above).
If, however, you’re faced with the perfect storm and have no idea about when the code got duplicated… well, the safest thing to do here is to declare data bankruptcy and start over fresh.
Everybody can check an analytics account. Yet, very few can tell whether or not the data they’re looking at can be counted upon.
We all make our fair share of mistakes. Unfortunately, when it comes to data, there’s no way of turning back the clock.
From our experience at GrowthSavvy, the best way to avoid these mistakes is to make a plan. Naturally, there’s also the option of hiring an expert who’s been working and studying this since forever.
Going back to having a plan, we advise you not to make any changes to your tracking without having a carefully crafted Measurement Plan and laying out the steps ahead.
You have no idea how much trouble this will save you. Should something go wrong, having a plan to fall back on means being able to zero in on your specific mistakes so you can fix them on the spot.
For more information about this, make sure to check our post on how to create a comprehensive analytics measurement plan.
Alternatively, we can also send our proven and tested Measurement Plan template to you via email. Just add your email address below and we’ll send it to you ASAP.