Audit This: Where Should Your Google Analytics Code Go? Why Does It Matter?

This is the first in (hopefully, what will become) a series of posts, where I focus on various items in our massive diagnostic checklist that we use for auditing Google Analytics and Google Tag Manager implementations for problems and for finding opportunities. This article focuses on the importance of your Google Analytics tracking code. 

Ever have someone say to you, “There’s no way your website’s Bounce Rate is below 10%”? How about “I don’t believe their data because it’s half what my Google Analytics says”?

These are red flags that you may have some pretty big tracking code problems with your Google Analytics. In this case, these problems could boil down to something as simple as putting your Google Analytics tracking code in the wrong place on your website.

One of the first things we usually do with a new Analytics client at Seer is to figure out if there is anything wrong with their data. We check out hundreds of ways your data can be messed up. The first focus when a client uses Google Analytics (GA), is to look at their Google Analytics tag placement and at how GA and Google Tag Manager (GTM) are implemented on their website.

Here’s Item #4 from our "Google Analytics and Tag Manager Diagnostic Checklist":

  • Google Analytics, On-Page, Code Placement: Evaluate whether Google Analytics tracking code is the correct code and has been put in the correct place

This is stupid important.

But the last time we went through an audit with a new Associate, I realized how terrible this checklist item is. How loaded is “the correct code in the correct place”? (Hint: super loaded.)

Why is where you add your Google Analytics Tracking Code important?

Here are some things that can happen to your data if you don’t put the correct Google Analytics tracking code in the right place:

Double or Triple Tracking

This is when  you are firing multiple “hits” to Google Analytics on every page load. Essentially, this makes your audience look seriously engaged with a super low bounce rate, a high pages per session, and lots and lots of pageviews. It makes you think your site is so much better than it really is, and if you are looking at pageviews instead of users, you might think that you are getting tons more traffic than you actually are.

Half Tracking

If your Google Analytics code is wrong or hasn't been added in the right place, it may not fire at the right timeor it may not fire at all. Your tracking code could get delayed by other bad code on your page that takes too long and hangs up everything on the page (like a bad 3rd party vendor tag you’ve put on your site and is slowing down your page load), or it could error out and not record anything at all.

Wrong Tracking

Related to the above, you could have “the right” Google Analytics tracking code, but if you've put the code in the wrong place, it could still send the wrong information. Maybe it’s bad information about the page itself or maybe it’s ecommerce transaction information, but if you put the tracking code on the page incorrectly, it’ll screw up your conversions.

Those are just a few of the issues you can run into if your Google Analytics code is wrong or in the wrong place.

I mean, this is the core tracking code for your digital experience—for many companies and organizations this might be the ONLY data that they actually own. It has to be as correct as you can make it.

What are some mistakes you might make if your Google Analytics tracking code isn't in the right place?

Incorrect Attribution

Everyone loves proper attribution, right? Hey! Guess what can happen if you a bad tracking code and/or a bad Google Analytics tag placement on your site? You can destroy your attribution.

With the right combination (usually with multiple trackers), you can destroy your session and referral information. Then, when someone lands on your site (say, from a paid ad or organic visit), they stay clocked in as the same user but with a different referral for last click attribution, or they become a completely new direct user with zero history with your site. In the first case, you can still assign some value from Multi Channel Funnels and Assisted Conversions, but with the latter, all your work getting that user to your site is unattributable.

User Bloat

If you place you Google Analytics code just right (i.e. wrong), you can make it look like every user is more than a single user. “Hurray! We doubled our users with the new website!”... (*cough* by improperly tracking them each as two people *cough*). As you can imagine, it’s not a good idea to use these  numbers. Because when you realize that you have been doing it wrong, you’re going to have to rip the Bandaid and cut your users in half. Then you’ll have to explain why your numbers are 50% lower than the expectations you set last quarter.

User Engagement Lies

If you are selectively incorrectly tracking parts of your site, you can get a heavily skewed view on your site. For instance, say you had a new blog manager who started publishing new content and it was super heavily engaged. The old content bounced at 98% but this new content was bouncing at 4%. So, what’s the deal? Do you have a great new blog manager writing great content, or a bad new blog manager who added new tracking code to the new blog pages, but forgot to remove the old code? It makes a difference.

Where should you put the Google Analytics Tracking Code on your website?

So, as of early 2017, what is the correct way to add your Google Analytics code? To answer that, I would first ask: "Is there a technically correct Google Tag Manager implementation on the page, and is the Google Analytics 'Universal' Code being delivered via Google Tag Manager… and nothing else?"

Here’s the Google Tag Manager code instructions.

That pretty much should be the only code on the page. That and related JavaScript and DataLayer objects are okay, but the important part for this is that there is no other Google Analytics code on the page, either for firing Pageviews or Events. None. Zero. Zip.

Maybe the most common problem is to have Google Tag Manager on your site working correctly, but you also have some older “Classic” Google Analytics tracking code that’s still firing to your account and property, giving you double tracking.

Once you get into what should belong in the DataLayer and what should be on the Google Analytics tag firing from Google Tag Manager, you’re opening up a huge can of worms. However, at the very least, the “Correct” code would be Google’s Universal Analytics tag firing most likely to All Pages from within Google Tag Manager.

In this scenario, when I look at the code on the page via Google Tag Assistant, I am only seeing your Google Tag Manager container and Google Analytics Pageview (being delivered via the container). Yes, you can have multiple pageviews firing to different Google Analytics properties—and maybe you even have a good reason to do that—but you shouldn’t be firing a pageview to the same Google Analytics property (shown by using the same I.D. like UA-12345-1 multiple times). Things can get complicated… But that part generally won’t change.

Last Words

Using the correct Google Analytics tracking code is paramount. Without good base tracking, everything else might be crap and you won’t know it. That’ll lead you to making bad decisions and embarrassing yourself in front of your boss, customer, or client.

It’s so much more than, “Put this tracking code there.”

It’s, “If you don’t do this a (proverbial) kitten will die.” That kitten is your data confidence.

It’s important.


We love helping marketers like you.

Sign up for our newsletter to receive updates and more: