There are two main reasons why you’d want to install Google Analytics tracking onto a WordPress site using Google Tag Manager:

  • You haven’t installed the Google Analytics tool yet and you’re doing it for the first time;
  • You HAVE installed it (maybe through a Google Analytics plugin like the Monsterinsights plugin or the WordPress plugin Yoast), but your Google Analytics dashboard isn’t showing any data and it looks like the installation went wrong;
  • You want to consolidate the Google Analytics tracking code (and ALL YOUR code – javascript etc.) in Google Tag Manager through your Google account;

In this blog post, I’ll go through the exact step by step process you need to follow to install Google Analytics onto a WordPress site / WordPress theme using Google Tag Manager.

Let’s get going.

Adding Google Analytics to a WordPress website will take about 15 to 30 minutes, and here’s the high level overview of how to get this done:

  • The goal: To add Google Analytics to a site using Google Tag Manager and verify that it’s working properly.
  • The ideal outcome: Google Analytics is properly installed and added to your site without any technical issues.
  • The prerequisites: You can only do this if you have already installed Google Tag Manager. If you haven’t done this already, check out our Google Tag Manager tutorial.
  • The importance of this action: Google Analytics is the most popular tool to measure traffic on your website and gather data on your visitors. Once you’ve done this, you’ll have access to thousands of metrics like how much traffic you’re getting and how your visitors are behaving on your website.
  • Where this is done: This will be done in Google Tag Manager and Google Analytics.
  • When this is done: You only have to do this once and, if you haven’t done it yet, you should do it ASAP.
  • Who does this: Whoever is responsible for managing your website or your Analytics.

Get This Entire Walkthrough and All the Resources in This Post

Set Up Your Google Analytics Account

If you haven’t already done this, you will first have to sign up for Google Analytics:

  1. Go to Google Analytics. If you haven’t signed up for an account yet, you’ll see a wizard that says “Create an account, start here”. Click that button.
  2. Enter your account name. In my case, this was “A Site About Emojis”.
  3. Enter your website name. In my example, this was also “A Site About Emojis”.
  • For a lot of people, the account name and the website name will be the same. This might differ if, for example, you’re setting up a company and then that company has multiple domains underneath. In that case, you might have an account name and then multiple website names underneath.
  1. Enter your website URL. In this example, this was “http://www.asiteaboutemojis.com”.
  2. Enter your industry category. This doesn’t matter too much, it’s basically just more information for Google.
  3. Set your time zone.
new GA account
  1. Underneath all the fields you have to fill out, you will see a few options Google checks by default. I usually uncheck them, but it probably doesn’t matter all that much either way.
  2. Click “Get tracking ID”.
get tracking ID
  1. Accept the “Terms and Conditions”.
google analytics terms of service
  1. You will now reach the section of Google Analytics where they give you your Google Analytics tracking code. If you are setting up the site normally, without Google Tag Manager, you might take this and paste it into theof one of your site templates in WordPress.

However, there’s a simpler way to do this, I’m going to show you how to do this through Google Tag Manager. So, instead of copying the Google Analytics code, copy the “Tracking ID” at the top of the screen – take that and paste it into a note.

copy tracking ID GA

Add the Google Analytics Tag to Google Tag Manager

Now that you’ve set up Google Analytics and copied your Google Analytics ID, head over to Google Tag Manager. Remember, if you haven’t set this up yet, you can check out our Google Tag Manager tutorial.

To properly setup Google Analytics using Google Tag Manager, you will have to go through three main steps:

  1. Creating the Google Analytics tag and tracking ID variable in Google Tag Manager;
  2. Adding the Google Analytics Universal tag and triggering it in the right pages;
  3. Submitting all of the changes you have made to your Google Tag Manager container;

So, here it goes:

Creating the Google Analytics Tag and the Tracking ID Variable in Google Tag Manager

  1. Log into Google Tag Manager.
  2. On the left hand side, click “Tags”.
workspace tags
  1. Click “New”.
new tag GTM
  1. Name your tag. You want to think about your naming convention—it will make it much more straightforward and easier to navigate Google Tag Manager in the future, especially if you start to add a lot of tags to it. So, my advice for you is to pick a really clear, easy to follow naming convention.
  • In my example, I used the convention “GA” (for Google Analytics) – so my tag’s name was “GA_TrackingCode”.
GA Tracking Code
  1. Click the little pencil under “Tag Configuration”.
tag configuration
  1. Click “Universal Analytics”. This is the current version of Google Analytics, so 9 times out of 10 you’re going to be using this one.
choosing tag type
  1. Click on the “Google Analytics Settings” drop-down menu → “New Variable”.
tag configuration
  1. In the “Tracking ID” field, paste the Tracking ID you saved to a note earlier.
variable configuration GA
  1. Click outside of the “Variable Configuration” box.
  2. Give this variable a name. In my case, this was “GA Tracking Code”.
  3. Click “Save”.
GA Tracking Code

Creating the Google Tag Manager Trigger for your Tag

  1. Click the little pencil under “Triggering”.
edit triggering
  1. Click the “+” sign in the top right hand corner.
choosing a trigger
  1. Click the little pencil under “Trigger Configuration” again.
trigger configuration gtm
  1. Click “Page View”.
choose trigger type
  1. Leave “All Page Views” checked.
  2. Name the trigger. In my case, this was “All Page Views”.
  3. Click “Save”.
naming your trigger gtm
  1. Click “Save” again.
saving a tag in gtm

Publishing your Google Tag Manager Container

  1. Go back to your Google Tag Manager Workspace.
  2. (Optional) If you have multiple changes you have made to Google Tag Manager, you can sort by “Last Edited” to see the Google Analytics one.
  3. In the upper side of the screen, you will also see the number of workspace changes. In my case, it shows “2” because there were 2 workspace changes that had not been submitted yet.
publishing your gtm container
  1. Click “Submit”.
submitting changes
  1. Add a Version Name and a Version Description. I usually choose to be quite descriptive here so that in the future, if someone else is working on this, they will know what was changed. In my case, the version name here was “Adding Google Analytics”, and the Version Description was “This update contains Google Analytics installation”.
  2. Click “Publish”.
submission configuration

Verify the Google Analytics Installation

Now that you have set up Google Analytics and added it to your Google Tag Manager, you will want to make sure it’s actually working.

  1. Install the Google Tag Assistant Chrome plugin.
  2. Go to your website.
  3. Open the Google Tag Assistant plugin.
  4. Click “Enable”.
google tag assistant
  1. Refresh the page.
  2. Open the Google Tag Assistant plugin again.
  3. You will see Google Analytics and Google Tag Manager there.
result of tag analysis

Alternatively, you can also verify your Google Analytics installation using the following method:

  1. Go to your website in one Chrome tab.
  2. Open Google Analytics in a new tab.
  3. On the left hand side, under “Reports”, click “Real Time” → “Overview”.
analytics overview
  1. You should be able to see at least your session showing up on Google Analytics.
real time overview

Creating Google Analytics Views

Once you have properly installed Google Analytics and checked that it’s working, there are some basic good practices you should setup straight away to make sure you future-proof your account.

One of them is setting up multiple Google Analytics Views.

If you go to your Google Analytics Admin, you will see three different columns there: your Account, your Property, and your View.

By default, Google Analytics will set up only 1 view named “All Website Data”. Having only this view will still allow you to take advantage of everything Google Analytics has to offer. However, this is not a good practice since you might start getting more advanced with Google Analytics in the future and start adding filters or other data processing settings to this view. In that case, you will not have a way to recover the unprocessed Google Analytics data.

Setting up at least these 3 different views will allow you to safely apply and test new settings on your view while minimizing any data-loss risks:

  1. Main View – where you do the majority of your analysis, your day to day stuff. This should be working flawlessly, without any kind of problems.

a) You can just rename the Google Analytics default “All Website Data” for this purpose.

GA staging view

b) To rename it, click on it → “View Settings”.

renaming a view in GA

c) Under “View Name”, enter “Main View” – this will help you keep things clean and organized in your Google Analytics.

naming your view

d) Click “Save”.

saving view changes in GA
  1. Staging view – your testing ground. This is where you run experiments, where you try out new things. You can mess this one up because it’s a staging view, so it’s to be used to test out new settings, filters, or any other configurations before moving them to the “Main View” (once you know they are working as intended)

a) Under the “View” column in your Google Analytics Admin Panel, click “All Website Data”.

setting up a view

b) Click “View Settings”.

view settings

c) Click “Copy View” (top right hand side of the screen).

copying view in GA

d) Enter “New view name”: “Staging View”.
e) Click “Copy view”.

Naming View - Staging View
  1. Unfiltered View – your raw data. You will just let this sit here and collect data, and never really touch it. This view will not have any new settings, it will always have Google Analytics’ default settings in it. This is your backup, and where you will go to if both the “Staging View” and the “Master View” data was corrupted by any change you’ve made.

a) Under the “View” column in your Google Analytics Admin Panel, click the “All Website Data” → “Create new view”.

unfiltered view in GA

b) Select “Website”.
c) Enter your view name (“Unfiltered View” in this case). This will have created your “Unfiltered View”.
d) Click “Create View”.

New View GA

That’s it! That’s how you add Google Analytics to a site using Google Tag Manager, how you make sure it is properly installed, and how you start making the most out of this tool. Doing this once will help you collect and analyze website data, so that you make better business decisions in the future!

More ClickMinded Resources

Double Conversions With Laser-Focused Google Analytics

Get the 2018 Ultimate Guide to Perfect Google Analytics Tracking sent to your inbox.

Share
Tweet
Share