The topic for this post was sparked by a question from one of our readers.
Kirk Williams of Zato Marketing asks, “Does having both GTM and GA on a site potentially duplicate data in Analytics? I’ve not seen it obviously do it, but we’re wondering if it would be problematic.”
So the question we want to answer today is, “Can You Have “Regular” Google Analytics and Google Tag Manager at the Same Time?” The simple answer is….
Yes You Can…
[Short answer]: Yes you can – just don’t fire a Page View tag via Google Tag Manager.
AKA, don’t set up this in GTM:
…But should you?
[Opinion alert]: Probably not. It can be fine. It can also be problematic, depending on how you have things set up. We’ve seen our fair share of messy analytics implementations, often caused by layers of analytics methods, whether that’s via WordPress analytics plugins, CMS configurations, weird copy and paste mix-ups, etc. Let’s explore!
What is “regular” Google Analytics tracking code?
To start things off, let’s make sure we’re on the same page. The following three examples are what hardcoded Google Analytics would look like on your site if you peeked at the source code:
The newest version, Global Site Tag (gtag.js) looks a little something like this:
Universal Analytics looks a little something like this:
The legacy version, Classic Analytics, looks a little something like this:
Each of these scripts would (likely) be pasted directly within the <head> tag of your site. These scripts contain ‘out of the box’ tracking that allows site owners to paste and begin tracking standard metrics.
What is a Google Tag Manager container code?
The Google Tag Manager container code inserts gtm.js into your site’s pages allowing it to fire your configured tags. Here’s an example of what Google Tag Manager container code looks like in the <head>:
Here’s what the accompanying code looks like in the <body>:
So what’s the problem?
Let’s set up the scenario where you’re like “Neat, we have Google Analytics on the site, I’ve heard about this other thing called Google Tag Manager; we should have that too!”
So you add the out of the box Google Tag Manager container code, which does nothing. It’s an empty container, so having that in and of itself would not cause any issues with GA code – but that also means that it serves no purpose.
So you then start to add things into the container, tags and whatnot (because GTM), and that’s when we’d likely start to see overlap and tracking duplication, as you try to add Universal Analytics via GTM. As we know, Google Analytics tracking code automatically tracks pageviews and other basic metrics, so adding a Universal Analytics Page View tag on top of that would cause your pageviews to be duplicated and your bounce rate to plummet.
To avoid this issue, we recommend using Google Tag Manager to simply house all of your analytics tracking.
How to make GA + GTM work
Let’s say you want to have some of the advanced functionality that the Universal Analytics Google Tag Manager provides (such as enabling cross-domain tracking – see Tip #10), but you have the hardcoded GA code on your site. Here’s a simple workaround we’ve developed for sites that ultimately require both GA and GTM for comprehensive advanced analytics tracking (Shopify, I’m looking at you).
You can still create a Universal Analytics GTM Tag that fires on all pages, but instead of selecting Track Type: “Page View”, you select “Event”. Therefore, instead of having duplicate pageviews (one fired from each GA and GTM), you would have an event tracked called “Page View” which would feed into the Behavior section of GA.
GA + GTM = Maybe
Having both hardcoded Google Analytics and Google Tag Manager on your site in and of themselves is not an issue. You’ll ultimately need to make sure you’re not duplicating your efforts and consequently duplicating your data. If you need to have both, then yes, you can. If you don’t, then no you shouldn’t. By simplifying your implementation, you get to take advantage of achieving excellent business buzzwords like ‘scalable’ and ‘seamless’.
Speaking of ‘seamless’, are you ready to switch to Google Tag Manager? Check out Mike’s blog post about how to Seamlessly Switch from Hardcoded Analytics to GTM.