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.

GTM Preview Pane Not Appearing in HTTPS Version of Website

Recently I tried to QA some tags within Google Tag Manager but had issues with the debugging console actually showing up. What was particularly perplexing about this issue was that the preview pane would show up for the non-secure version of the website, but not the secure version of the website. After doing a quick Google search and running through the 17 possible suggestions to fix the issue provided by Analytics Mania, I was still at a loss.

Luckily I work with some pretty smart developers who were able to determine it was a problem with the way the base tag was working. Once that was fixed, we were able to see the preview pane and debug our tags without a problem

What is a Base Tag?

The base tag, also called the document base URL, is a tag located in the header that “specifies a default URL and a default target for all links on a page” (W3 Schools). So say for example you have a domain called link going to your About Us page and the link is simply /about-us/. Your base URL will determine the domain attached to /about-us/. A base URL isn’t required in development. Depending on how it’s implemented, it can help you or hurt you. In our case, it hurt us.

BaseURLHTML

Relativity and GTM’s Debug URL

Google Tag Manager’s main script is a secure script. The debug script is a relative script. You can tell that because instead of starting with a hostname, it starts with //.

Google Tag Manager Debug URL

Most times the relatively of GTM’s debugging URL isn’t an issue. However if the base URL forces an unsecure URL, the preview mode won’t work. If you see this issue, please contact your developer to update the base tag to reflect a secure URL. Voila! Your preview pane will be working again.

Summary

The list of reasons why Google Tag Manager preview pane won’t show up is seemingly endless. Reviewing your base tag can be one more check on your list to ensure you can properly debug your tags.

Stay in the know with email updates!

* indicates required

Implementing Google Analytics Event Tracking & Understanding How It Affects Your Data

You’ve just learned all about event tracking and the fact that you can track more on your website than you ever thought possible. Now it’s time learn how to implement event tracking and the effect it can have on your Google Analytics metrics.  

How To Implement Event Tracking  

Google Analytics event tracking can be added to your website one of two ways. With both ways you’ll still first need to determine your category, action, label, value (if applicable) and what exactly is being tracked.  

The first way to implement event tracking is to have a developer write the event tracking in your website code and have the event sent directly to Google Analytics. Here, most of the heavy lifting lies on the developer. However, if you have Google Tag Manager installed on your website, you may want to opt for the second way.   

With Google Tag Manager you can implement Google Analytics event tracking yourself, without involving a developer. Once you log into Google Tag Manager, select the Google Analytics event tag and fill in your category, action and label. Next, set up your trigger – when the event tracking will fire (occur). This trigger may range from an anchor tag ID clicked on one of your CTAs to a click url for your PDFs to the visibility of “thank you” text for form submissions.  

google tag manager google analytics event tracking

The Effects of Event Tracking on Google Analytics  

After you implement event tracking, it’s likely that you’ll start to look into your Google Analytics. The first thing you may notice is a drop in your bounce rate. That’s because by default, event tracking is not a non-interaction hit. To better clarify, let me dive into hits, non-interaction hits, and bounces for a minute.  

bounce rate drop after google analytics event tracking
Bounce rate can drop after you implement Google Analytics event tracking.

Every time you have an interaction on your website that results in data being sent to Google Analytics, it’s called a hit. As mentioned in the beginning of this post, Google doesn’t track most of your interactions by default, limiting the number of hits Google Analytics receives. Whenever you implement event tracking, you begin tracking interactions that weren’t tracked before, which sends more data (hits) to Google Analytics. By default these hits are not non-interaction hits.  

A bounce on your website is defined as an instance when only one interaction was had on your website before a user leaves. Now that you’re recording more second interactions on your website, you’ve got less bounces, which lowers your bounce rate. If you’re ever interested in event tracking without lowering the bounce rate, have your developer label these events as “non-interaction” hits or do it yourself in Google Tag Manager.  

Summary 

Knowing how to implement Google Analytics event tracking and its effect on your data will make a world of difference when making data driven decisions. You may be tempted at this point to track everything under the sun. But before you do, read about what not to track with event tracking so you can be sure you’re only tracking metrics that matter. 

Stay in the know with email updates!

* indicates required

Why Do I Need Google Tag Manager When I Have A Developer?

 

In this blog I’ll go into the details of Google Tag Manager and why you’ll still want it even though you have a great developer. 

To begin with, if you haven’t read my blog on the difference between cookies, pixels, and tags, take a minute (15 of them really) to catch yourself up on the “tag” part of Google Tag Manager. 

What is Google Tag Manager 

Google Tag Manager is Google’s free tag management system. It’s a centralized location for marketers and other non-technical people to add, remove, and modify tags and other code snippets without altering the website code. 

The technical definition is helpful, but I find a metaphor really helps drive home what Google Tag Manager does and how it’s different than other Google programs, such as Google Analytics. 

Google Tag Manager Is Your Wallet

To begin with this metaphor, think of your tags as credit cards. If you have one credit card, it’s pretty easy to keep track of. This is often the case with people who only have one tag running on their website, for example Google Analytics.  

Additionally, if you’ve only got that one card, it’s pretty easy to throw that credit card into a purse without the use of a wallet. Developers have a similar process with your tags – they just throw your tag into a section a website, leaving you to read the every line of code if you ever want to find out which tags you have.  

Women, you know that your purse can often be a black hole. And men, although you may not own a purse yourself, if you’ve ever had your wife, girlfriend, friend or sister ask you to find something in their purse, you know it’s not a task for the faint of heart. This is why when marketers began getting more sophisticated with tracking and adding more tags to websites, i.e. throwing more cards in your purse without using a wallet, the need for a tag management system arose. 

A tag management system is like a wallet. Simply having a wallet doesn’t mean you have credit cards in that wallet, but now you have a more organized system in place for future cards. You may even decide you want to go back and take some cards out of your purse and put them into your wallet.  

While moving all your tags from your website code to Google Tag Manager may be a more time-consuming task than moving a credit card into a wallet, in the end you’ll have a more centralized place to store all these tags and be able to easily adjust them in the future. 

Developers and Google Tag Manager 

Earlier I said that tag management systems are useful because they don’t require a developer. This is completely true. However tag management systems like Google Tag Manager can be as complicated or as simple as you make them.  

Google provides lots of built-in variables for you to use, such as URLs, click IDs, and click text, but if you’re looking to reference more complex conditions, you may want to pull in a developer. A developer can look at the code on the page and then determine whether or not some custom javascript needs to created to be deployed in Google Tag Manager. 

Summary 

If tags are like credit cards, Google Tag Manager is the wallet that keeps them all in one place. Even if you have a developer, this handy tool is nice for keeping everything in one place without having to interpret any code. 

 

Stay in the know with email updates!

* indicates required