Analytics Tip of the Week: Set Up Google Tag Manager


By Jay Adamsson

Welcome back to Week 5 of our series: Analytics Tip Of The Week. We took off last week, as it was Remembrance Day here in Canada, which is a holiday.

Every Monday morning we’ll be providing a quick tip for your website Analytics. We’ll be presenting topics not just as a “how do I do this”, but “how can this help me”. Data alone may be interesting, but it’s only when we use the data that it becomes valuable.

Quite often, our tips will be Google Analytics related, but not always. Remember, there is a lot more to website analytics than just Google Analytics. We can’t forget other properties like your social media analytics, how best to implement Google Analytics, and perhaps the most important of all: reporting results in a way that makes sense and prompts continual improvement.

A Better Way To Collect Analytics – Google Tag Manager

How do you collect Analytics on your site? Is it by adding the code from Google Analytics to your website directly on every page? Or by putting your Google Analytics Tracking ID into a WordPress plugin like Yoast or All-In-One-SEO?

Did you know that there is a better way?

That better way is called Tag Management. And how is it done? With Google Tag Manger.

What Is A Tag

A tag is a little bit of code placed on your website that helps with tracking, reporting, analysis, or sharing information with another website or service.

Your Google Analytics Tracking Code, which Google Analytics suggests you place on every page of your website, is a Tag. If you use a WordPress plugin, they take your Tracking ID and add a Tag to every page of your website.

If you use Facebook or Twitter advertising, they provide a pixel that you add to pages on your website. That is a Tag.

Google AdWords asks you to put a Conversion tag on every page.

And the list goes on. If you do a lot of online advertising, you can end up adding a lot of tags to your website. And that’s where Google Tag Manager comes in.

Google Tag Manager

Google Tag Manger (or GTM for short) is a service offered by Google that takes all of those little snippets of code and moves them off your site. In their place, you add one single Tag – the one for GTM. Then, every time someone visits your website, GTM takes care of making sure all of those Tags are executed.

But there’s more that that to GTM, especially when it comes of Google Analytics. When you add the Google Analytics code directly to your site, information about your site is reported directly to Google Analytics. But with GTM, the information is collected by GTM before being sent to Google Analytics. That provides an opportunity to actually alter the information that is collected in your Analytics account. For most small websites this isn’t an issue. But with more complex websites, this is a capability that saves a lot of time and greatly improves the quality of the data being collected.

Basics of GTM

Main Menu of Google Tag ManagerWhen you sign up for GTM at tagmanager.google.com, it is a little bewildering at first. You will be taken through a few steps to set up your account – for the most part, these are pretty straight forward. You will have to put the GTM Tag on every page of your site (speak to your website developer if you don’t know how to do this – it’s actually pretty easy in most cases.) You will also want to remove any existing tags from the site, such as your Google Analytics code.

There are three principal components of GTM – Variables, Triggers and Tags. Once you understand these three items, then GTM makes a lot more sense.

Variables are values that you might want to remember and use in multiple places. The most common variable is your Google Analytics ID (it looks something like UA-123456-01). This is something that has to be used on every page on your site, and when you get into more advanced Google Analytics tracking, for a number of other items.

Triggers tell GTM when to do something. For example, with Google Analytics, you want to track every page that is visited by a user. So, a trigger is set to fire on every page. When you start using more advanced Google Analytics, you will want other triggers – such as “fire when someone purchases an item” or “fire when a user downloads my book”. Triggers identify the important events that happen on your website that you want to track.

Tags, as we mentioned before, are little pieces of code that communicate with other websites or services. While the tags tell GTM when to do something, it is the tags that tells GTM what to do. For Google Analytics, the trigger says “I want to do something on every page”. The Tag says “tell Google Analytics that a user visited this page”.

Tags and triggers work together very closely, so why are they separate? Why not just have a tag that says “Tell Google Analytics that someone visited on every page?” Because triggers can work for many tags. You may want to also tell Facebook and Twitter that a user visits a page. Because they are separate, you can create one trigger that fires on a page. Then three tags – one for GA, one for Facebook and one for Twitter – rather than having to duplicate effort.

How to Set Up GTM

To set up basic Google Analytics tracking in GTM, there are just two steps. First, you have to set up a variable with your Google Analytics ID, then set up a tag to fire on all pages. Note that we don’t have to set up a trigger in this case – GTM creates a default trigger for you to use.

Recently, GTM created a special Google Analytics Setting variable to help with this. To set this up once you are in your GTM account, first note your Google Analytics ID then do the following:

  • Click on “Variables” on the left side of the screen
  • Scroll down until you see the section for “User-Defined Variables” and click on the “New” button
  • Replace the name of the Variable where it says “Untitled Variable” to “gaSettings”
  • Click in the box that says “Variable Configuration”. Under “Choose Variable Type”, scroll down and select “Google Analytics settings”
  • In the box for “Tracking ID” enter your Google Analytics ID.
  • Click on “Save”

The second step is just as easy – set up the GA Tag:

  • Click on “Tags” on the left side of the screen
  • Click on the “New” button
  • Replace the name of the Tag where it says “Untitled Tag” to “UA – Page View – All Pages” (note that this name is a bit complex, but follows a common naming convention. In reality, you could call it whatever you wish)
  • Click in the box that says “Tag Configuration”. Under “Choose Tag Type”, select “Google Analytics – Universal Analytics”
  • In the box that says “Google Analytics settings”, select the variable “{{gaSettings}}” you just created. The two curly braces tells GTM that you are talking about a Variable
  • Click in the box that says “Triggering” and select “All Pages”
  • Click the Save button

Congratulations, you have now set up GTM to collect you Google Analytics data. There is one final step that is left – tell GTM that you want to make these changes live:

  • Click on the button on the top right that says “Publish”
  • Enter a Version Name (such as “Basic GA Tracking”)
  • Click on the “Publish” button again

You are now tracking your Google Analytics data through GTM.

What’s Next

Let’s face it – so far all we’ve done is duplicate the GA tracking that was already on the site. Not very exciting.

But you’ve now opened up your website to lots of other possibilities, and we’ll be exploring that in the next few posts, where we will talk about Google Analytics Events – what they are, why they are important and how to track them.

 

Supportscreen tag