How to add Google Analytics to WordPress: A Beginner’s Guide

Tommy Griffth
calendar icon
Jul 6, 2023
time icon
7 min. read
Back to Blog
Table of Contents
Primary Item (H2)

A simple guide on setting up Google Analytics on WordPress site by using Google Tag Manager. Perfect for beginners and non-technical people.

There are two main reasons why you’d want to install Google Analytics tracking onto your 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 WordPress plugin like the Monsterinsights plugin, the WordPress plugin Yoast, or any other Google Analytics plugin), 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 – HTML, Javascript, PHP, etc.) in Google Tag Manager through your Google account. Google Analytics tracking code collects information about how people use a website, like which pages they visit and where they came from.

In this blog post, We will go through the exact step-by-step process you need to follow to install Google Analytics on your WordPress site / WordPress theme using Google Tag Manager.

Sidenote: If you’re not using WordPress, check out our guides on how to add Google Analytics to your e-commerce store on Shopify or Squarespace.

Let’s get going.

Adding Google Analytics to a WordPress website will take about 15 to 30 minutes. Here’s a high-level overview of how you can optimize your website to track visitor activities on your website:

  • 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 and install it now.
  • The importance of this action: Google Analytics is the best WordPress analytics tool to measure traffic on your WordPress site 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, where your audience comes from ( organic search, social media, referrals from other websites, etc.), audience demographics, bounce rates, and user behavior 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: Your WordPress admin or whoever is responsible for managing your website or your Analytics.

Get This Entire Walkthrough and All the Resources in This Post

Setting 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 a Google Analytics account yet, you’ll see a setup 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 domain names underneath.
  1. Enter your website URL. In this example, this was “”.
  2. Enter your industry category. This doesn’t matter much, it’s just more information for Google.
  3. Set your time zone.
  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”.
  1. Accept the “Terms and Conditions”.
  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 one of your site templates in your WordPress Dashboard. 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 snippet to the header of every web page you want to track, copy the “Tracking ID” from the Tracking info section at the top of the screen – take that and paste it into a note.

Add the Google Analytics Tag to Google Tag Manager

Now that you’ve set up Google Analytics and copied your Google Analytics tracking 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 set up 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 on 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”.
  1. Click “New”.
  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”.
  1. Click the little pencil under “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.
  1. Click on the “Google Analytics Settings” drop-down menu → “New Variable”.
  1. In the “Tracking ID” field, paste the Tracking ID you saved to a note earlier.
  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”.

Creating the Google Tag Manager Trigger for your Tag

  1. Click the little pencil under “Triggering”.
  1. Click the “+” sign in the top right hand corner.
  1. Click the little pencil under “Trigger Configuration” again.
  1. Click “Page View”.
  1. Leave “All Page Views” checked.
  2. Name the trigger. In my case, this was “All Page Views”.
  3. Click “Save”.
  1. Click “Save” again.

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.
  1. Click “Submit”.
  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”.

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”.
  1. Refresh the page.
  2. Open the Google Tag Assistant plugin again.
  3. You will see Google Analytics and Google Tag Manager there.

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”.
  1. You should be able to see at least your session showing up on Google Analytics.

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 set up 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 analytics report 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.

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

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

d) Click “Save”.

2. 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”.

b) Click “View Settings”.

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

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

And that’s it! This is how you become a pro at adding analytics to WordPress. I hope that was helpful. That was the exact step-by-step process you need to follow to install Google Analytics onto a WordPress site / WordPress theme using Google Tag Manager.

Even More Resources

If you’re JUST getting started with digital marketing and SEO, take a look at the digital marketing strategy guide or the website analytics guide to learn how to develop your comprehensive tracking strategy.

If you’re ready to take your tracking to the next level, be sure to check out the ClickMinded Google Analytics Training Course.


Double Conversions With Laser-Focused Google Analytics

Get the Ultimate Guide to Perfect Google Analytics Tracking sent to your inbox, for FREE!