Snippets

How to Configure Google Analytics with Google Tag Manager

background

I’ve been placing the Google Analytics tracking code on websites since before I needed to shave. Seriously.

As a technically-savvy digital marketer, it may be the most common job function I’ve performed over the course of my career. Up until a few years ago, the process was fairly simple: create an account, copy the tracking code, and place on your website.

With the introduction of Google Tag Manager in 2012, the installation process became slightly more involved even though its purpose was to simplify tag management (which it does by consolidating tags with a single snippet of code that you can manage from a web app).

Before getting into the setup process, I want to provide a little bit more context and purpose to make sure you’re drinking the Kool-Aid.

What is a Web Tag?

Web tags are tiny bits of website code that help provide useful insights like behavior patterns or trends by gathering data on a website. They have many applications like third-party tracking, analytics, reporting, remarketing, conversions, live chat…the list goes on. Generally speaking, they are an important piece of an organization’s marketing technology.

Why Use Google Tag Manager?

Although you can still configure Google Analytics without Google Tag Manager (GTM), it’s recommended to configure both at the same time. There are plenty of advantages in setting up both, especially when you think beyond just Google Analytics.

Do you use Adwords Conversion Tracking, Adwords Remarketing, or the Facebook Pixel? These applications can all be set up in Tag Manager and you can determine when the tag should fire, when the tag shouldn’t fire, what pages the tag should fire on, and what the tag should do when it fires.

There are many advantages beyond managing many tags in the same place:

  • Place the GTM container code on your website once and eliminate the need to edit website code again.
  • Test and deploy tags quickly, without the assistance of an IT or web team. Remember, you only need to place the container code on your website once!
  • Many tags already built into GTM provide advanced analytics tracking. For example, globally add event tracking on external links or buttons without manually adding the code to individual links.
  • If one tag deploys asynchronously (loads more slowly), it won’t affect other tags being fired on the page.

See the benefit in configuring Tag Manager with Google Analytics?

How to Set Up Google Tag Manager

Setting up Google Tag Manager is quick and easy—you create an account, add one snippet of code to your site, then start managing tags.

Create an Account

This is pretty straightforward. Navigate to tagmanager.google.com and click “Create Account”. You should see a screen that looks like this:

Creating a Google Tag Manager account

Fill out relevant details related to your website and select “Web” for Target Platform. Next you’ll have to read and approve service terms to officially create the account.

Install Google Tag Manager Snippet

As soon as you create the account, a screen pops up with instructions on how to install the code snippet:

Google Tag Manager snippet

Send those instructions to whomever manages your website. Additionally, Google provides a quick start guide on their website.

You’ll want to test that the tracking code has been placed correctly. We recommend downloading the Google Tag Assistant off the Chrome web store. It’s really easy to use and it will be helpful later to test whether the Google Analytics tag is firing correctly.

At this point, you’re ready to start adding tags.

Deploy Google Analytics with Tag Manager

We’ve created our GTM account and placed our code successfully. Now, we’re going to install the Google Analytics tag.

First and foremost, if you already have Google Analytics installed on your site, you’ll want to have your web admin remove it. The reason for this action is if you use both, it’ll track everything twice and provide inaccurate data.

Once that’s squared away, follow the steps below.

1. Within the main GTM interface, you’ll want to click “Add a new tag”. You’ll be brought to a screen that looks like this:

Add a new tag in Google Tag Manager

2. Click on “Tag Configuration” and then select “Google Analytics: Universal Analytics”. You’ll see a bunch of other options, but let’s ignore those for now. You’ll be brought to another screen that looks like this:

Add Google Analytics tag to Google Tag Manager

3. Leave the Track Type field as “Page View”. Know that this is where you can configure items like link clicks and event tracking in the future. Remember, one of the benefits of GTM is advanced analytics tracking.

4. Next, you’ll want to select “New Variable” on the Google Analytics Settings picklist. Note that you may have a variable already created, in which case you can select the desired variable from the picklist.

You will be taken to a screen that looks like this:

Configure a variable in Google Tag Manager

a. In the Tracking ID field, enter your Google Analytics ID.

b. If you have no other Google Analytics tags deployed on your site via analytics.js or from Tag Manager, you should leave this value set to “auto”. If you have other Google Analytics tags set up on your site or in Tag Manager, you should confirm that the Cookie Domain value is consistent.

c. Let’s ignore the additional settings for now. Know that you can configure a bunch of other settings like custom fields, custom dimensions, custom metrics, content groups, display advertising features, cross domain measurement and much more.

d. Finally, name the variable and click “Save” to complete creating the variable.

5. We’re almost done. Click on “Triggering” and select the default option that comes up “All Pages”.

6. Name the tag and click “Save”. At this point, your screen should look similar to this:

Trigger Google Analytics on all pages

Finally, you’ll want to click “Submit” and then “Publish” to push your changes live.

You can test two different ways to see if the code is working. Either navigate to your website where the container is placed and use the Tag Assistant extension to confirm. Or, navigate to your website then login into Google Analytics and check Real-Time tracking to see if your pageview is being tracked.

That just about covers a basic Google Analytics and Google Tag Manager installation; however, there are a ton more configurations you can make to get more detailed tracking and analysis. I recommend setting up events next.

If you have any questions, we’re here to help! Click on the chat in the bottom right corner and we’ll guide you in the right direction.