Why Is An Old Google Analytics Code Bad?

I’ve been in the world of SEO for nearly seven years now, becoming a self-proclaimed expert Googler on everything from Excel formulas to home improvement hacks. However, when faced with the challenge of telling a client why having Classic Google Analytics on their website was not optimal, the only search terms that came to mind were “Why Is An Old Google Analytics Code Bad?” 

After my ever-so-sophisticated search, I found myself getting lost in Google Analytics developer documents that were way over my head and articles that hadn’t been updated since Universal Analytics first made its debut out of beta. My loss, however, is your gain.

This guide will give you a high-level look at the different iterations of Google Analytics and why you really should update your Google Analytics code. If you’re looking for a detailed Google Analytics timeline, I highly recommend this Google Analytics article by BCS Blog.

Google Analytics Infancy: Urchin + Google

Google Analytics did not start at Google. It was started by Urchin Software Corp, which Google acquired in 2005. If the name “Urchin” sounds familiar, that’s because it should. Urchin is the “U” in UTM Coding (you can read more about UTM Coding here).  

How Can I Tell If I’m Using urchin.js?

The easiest way to see if you’re using Urchin is to search the source code for google-analytics.com/urchin.js– don’t be surprised if you don’t find it, though. BuiltWith estimates that only 7,212websites still use Urchin for their analytics.

Google Analytics Childhood: Classic (Legacy) Google Analytics

In April 2007, Google released the first version of ga.js, a synchronous script that was faster, more secure, and gave users access to more features than its Urchin predecessor. In addition to the library released in 2007, there were two ga.js upgrades released in 2009 and 2012. In 2009, Google updated the tracking script to be asynchronous, preventing it from slowing down other resources on a website. In 2012, Google updated the ga.js script to allow for better targeting of Display ads. All versions of ga.js are now referred to as Classic Google Analytics or Legacy Google Analytics because the library is now a legacy library.

How Can I Tell If I’m Using Classic Analytics?

The easiest way to see if you’re using Legacy Google Analytics is to search the source code for google-analytics.com/ga.js. BuiltWith estimates that 6.8 millionwebsites still use Legacy Google Analytics. If you deploy your Google Analytics code through Tag Manager, check inside Tag Manager for a Classic Google Analytics tag.

Classic Google Analytics in Google Tag Manager

Why Should I Change from urchin.js to ga.js?

Note: MoreVisibility wrote an excellent article on this that goes into this in much more detail. I highly recommend checking it out here:

  1. Faster.When implementing your tracking script, you’ll notice that both the Urchin and Google Analytics code reference a script source. When you load urchin.js (https://www.google-analytics.com/urchin.js), you’ll notice the code is near 700 lines. In contrast, when you load ga.js (https://www.google-analytics.com/ga.js), you’ll notice the code is much smaller – only 84 lines!
  2. More Secure.Google Analytics doesn’t store any PII (Personally Identifiable Information). However, it does need to distinguish User 1 from User 2. By increasing the safety of their namespace, this means it’s harder for Google to tell that you’re you.
  3. Access to More Features.  Event tracking, real-time reporting, multi-channel funnels, flow visualizations, data import, custom alerts, custom reports, and data import are a few of the new features that came with the migration to Classic Google Analytics. 

Google Analytics Adolescence: Universal Analytics

Although we may use Universal Analytics and Google Analytics interchangeably now, Universal Analytics was considered very different from previous iterations of Google Analytics when it was first announced in October 2012 and then released from Beta in March 2013. Universal Analytics opened up a world of possibilities for website owners and allowed for more customization of our website analytics than ever before.

How Can I Tell If I’m Using Universal Analytics?

Much like Classic Google Analytics, there are two ways to check if you’re using Universal Analytics. The first way is to see if you’re using Universal Analytics is to check if you have the Universal Analytics tag within Google Tag Manager.

Universal Analytics in Google Tag Manager

If your Analytics account is more than six years old, there’s a strong chance you started with Classic Google Analytics. If this is the case, your transition would be a two-step process, and you’ll want to check more than your website code. When you open up the Google Analytics interface, you want to make sure it doesn’t give you a warning that the Universal Analytics transfer hasn’t started. If you don’t see the warning below, you’re good to go!

Image courtesy of Google

Why Should I Change from ga.js to analytics.js?

With the release of analytics.js, Google not only allowed users more configuration of existing elements but also more advanced integrations with offline data.

  1. Adjust Your Time Outs & Exclusions: With analytics.js, you get to customize the time outs for your campaigns and your sessions. By default, a campaign times out at six months, and a session times out at 30 minutes. You also get to add search engines so it doesn’t appear as referral traffic, exclude search terms so the traffic is attributed as direct instead, and exclude referral sources so you can better prevent self-referrals. 
  2. Better Tracking Across Domains: In Classic Google Analytics, tracking across subdomains required additional configuration because the Google Analytics cookie wasn’t set to the highest possible level. Google fixed this with the automatic cookie domain configuration in Universal Analytics, and now users can track across subdomains without any extra work. 
  3. Better Tracking Across Devices: The introduction of the User-ID allowed any website with a login to start tracking users across devices. While you still needed a developer to implement this feature, this gave a better picture of the customer journey.
  4. More Custom Data, Less Manual Work: Classic Google Analytics gave us data import and custom variables. Universal Analytics gave us V2 of those features. With the measurement protocol, we wouldn’t have to manually import outside data anymore, it could be done via a feed. Universal Analytics also transformed custom variables into custom metrics and custom dimensions, which meant easier reporting and easier implementation for website owners (a nice custom variables vs. custom dimensions list can be found here).

Google Analytics Awkward Post-Grad Years: Global Site Tag

A history of Google Analytics wouldn’t be complete without talking about gtag.js, the fourth library used by Google Analytics. This library was released in beta in August 2017 and is now the recommended Google Analytics library, unless you’re deploying Google Analytics through Google Tag Manager.

Admitted author bias: When I discovered the benefits of deploying my tags through Google Tag Manager, I ignored any new Google Analytics libraries. After looking at BuiltWith trends, however, it appears I am in the minority. 12.2 million websites use the Global Site Tag, while only 9.3 million websites use Google Tag Manager. If you are hesitant to switch over to Google Tag Manager, I totally understand, but I implore you to dig deep within and find the courage to make the switch. Even Google recommends Google Tag Manager over the Global Site Tag. I have an introductory piece on GTM here that should make it a little less scary.

How Can I Tell If I’m Using the Global Site Tag?

The easiest way to see if you’re using the Global Site Tag is to search the source code for www.googletagmanager.com/gtag/js.

Why Should I Change from analytics.js to gtag.js?

Again, I really recommend you go straight to Google Tag Manager, but if you insist on carrying on without it, I can’t stop you. Here’s why gtag.js could be a nice upgrade from analytics.js for you:

  1. One Tag For All Google Products: Unlike previous libraries, gtag.js isn’t a library solely for Google Analytics. Rather it’s a wrapper library that contains your analytics.js (Google Analytics) script, your conversion.js (Google Ads) script, and other Google scripts. This helps consolidate tracking because now all Google products will use the same event command.
  2. Grouping For Multiple Websites: The Global Site Tag makes it easier to send analytics hits to multiple accounts at once without duplicating tags, by providing a feature called “grouping.” Grouping is exactly what it sounds like – you can place multiple accounts into one group and can instruct Google to send hits to everyone in that group.
  3. DataLayer: The dataLayer was previously only used by one Google product –  Google Tag Manager. With the introduction of the Global Site Tag, the vendor-agnostic data container is now available to a wider audience, and developers can now avoid the DOM scraping that was previously needed to achieve the same results.

Summary

Outdated code is not only less reliable, but it often means you miss out on new and cool features. If you’re still currently using urchin.js, ga.js, or analytics.js, there’s reason to upgrade to the latest implementation of Google Analytics, whether its through the use of the Global Site Tag or Google Tag Manager. Both will help better prepare you for the next iteration of Google Analytics, Google Analytics 4, which was released in beta in October 2020.