Tag management, and Google Tag Manager, exist to make web analytics implementations easier. If you’ve got a fairly simple site then you should consider using Google Tag Manager to implement Google Analytics. It greatly simplifies the process.
The Standard Google Analytics Tag Implementation
Let’s Walk through a very basic Google Analytics setup using Google Tag Manager. Here’s a video if you don’t want to read :)
I’ve got a small site that used to sell my old e-book. I want to implement the standard Google Analytics tracking code on this site using GTM.
The first thing I need to do is create a container. The container will hold my Google Analytics tag along with any other tags that I may wish to put on the site.
There’s not too much involved in creating a container. You need to name the container and choose a timezone.
I should mention that Adding a domain to the container is not necessary. It just triggers various help in the user interface. While not necessary I recommend adding a domain.
Great, now we’ve got a container and it’s time to populate the container with our Google Analytics tag. The GTM team made it easy to install Google Analytics by creating a form for most of the GA tag options, as shown below:
For a simple implementation all you need to enter is the web property ID. This is the UA number. You can find it in your Google Analytics account.
Note: Google Tag Manager currently supports only the basic Google Analytics tag. Future releases of Google Tag Manager will allow you to customize your Google Analytics tag.
Next you need to specify the rules associated with your Google Analytics tag. The rules control which pages the Google Analytics tag will appear on. To learn more about rules see this post about understanding Google Tag Manager.
For this implementation we want to add the Google Analytics tag to appear, or fire, on every single page. We can use a default rule that meet this condition.
Once you click Save GTM will save the tag in the container BUT the tag will not be pushed live to your site. You still need to publish the tag. And you should also Preview the tag before publishing, just to make sure it works right.
If you’re interested in learning more about the tag preview and publishing process check out my post on understanding how to preview and publish with Google Tag Manager.
A lot of you are probably thinking about more complex implementations, like those that require cross domain tracking. Right now a lot of those choices are not supported with the standard Google Tag Manager – Google Analytics integration.
But there is another way to implement Google Analytics with Google Tag Manager.
The Generic HTML Tag Method
If you have a more complex implementation, you can use the Generic HTML Tag for the implementation. This type of GTM tag is basically arbitrary HTML. You can put anything you want in this tag. This includes the Google Analytics tracking code and any customizations that you want to include.
As you can see, you can put the GA tag in the basic HTML tag, with any customizations that you want.
Is it more work than using the standard GTM GA tag? Maybe a little. But if you want to switch to Google Tag Manager ASAP, and you have a complex implementation, then this is the method for you.