Google Tag Manager for your WordPress site – The 5-minute Guide

Author: Jeff Sauer
Go to Source

EdTech Café

EdTech Cafe
 Standford EdTech (Author)
EdTech Café is a podcast series produced by the educational technology team at Stanford Medicine.

When it comes to managing your WordPress website, Google Tag Manager (GTM) should be one of your go-to tools.

Why? Because GTM allows you to add tracking to your site while keeping it a lean, mean high-page-load-speed machine… which allows you to keep visitors on your site longer and give them more of what they want.

Follow along, and I’ll show you how you can install Google Tag Manager on your WordPress site in 5 minutes or less. And, we’ll also look at how to start tagging your site using GTM.

If you want to take the instructions I’m covering in this video and blog post (so you always have them handy), you can download our GTM Account Setup & Installation Checklist below.

And, if you want to jump ahead, here’s a quick overview of what we’ll cover in this guide:

How do I use Google Tag Manager for my WordPress site?
Installing GTM on your WordPress site
Install GTM on your site the technical way
Install GTM on your site the fast way
Installing GTM on a brand new WordPress Site (in 5 minutes or less)
Verifying your GTM installation was a success
Start tagging your site

How do I use Google Tag Manager for my WordPress site?

If you’re a digital marketer or business owner who manages your own website, think of GTM as an easy button for collecting data.

Here’s what I mean by that. You know all those tracking tags you need to install on your site to do business online?

There’s one for Facebook… and one for Google Analytics… and one for Google Ads… and one for LinkedIn… and one for your email marketing system… and on and on.

So many tracking tags

We’ll, GTM helps make it easy for you to install those tags on your site, even if you don’t know jack squat anything about website code… which means you don’t have to rely on a web developer to install your tracking code for you.

Also, GTM helps prevent your site from crashing or slowing down under the weight of all the tracking tags you need to run your business.

And if you have a WordPress site, you can do a quick clean installation of GTM in 5 minutes or less.

Installing GTM on your WordPress site

Before we get into the action with our GTM installation, let’s take a quick look at the basic steps you’ll need to follow.

And, I’ll also break down the options you have for executing your installation.

There are two pretty simple steps for getting GTM up and running on any website.

Step #1 – Set up a GTM account.

You can set up a GTM account by navigating to – https://marketingplatform.google.com/about/tag-manager/.

Create a Tag Manager Account

Step # 2 – Add your GTM tracking code to your site

Now, for those of you who are ready to viciously hit the back button because I told you this would be simple… but now I’m telling you that you have to add code to your site, hang on just a minute, and hear me out.

GTM is Easy

You have a couple of options for getting your GTM code on your site.

You can choose the hard “technical” way and manually install your GTM Code on your site.

Or, you can choose the easy way and use a plugin.

Since this guide is all about getting the job done, we’re going to focus on the easy “codeless” way to install GTM.

But first, (to satisfy all you control freaks), we’ll address installing your Tag Manager code on your site manually.

Install GTM on your site the technical way – Add the script to your theme

Your GTM code contains two sets of scripts (i.e., snippets of code). One of these scripts goes in the header of your website. The other tracking script goes in the body.

GTM Code

Now, installing your header code isn’t too difficult.

But, if your WordPress theme doesn’t have hooks, installing your body script can be a little more tricky.

While it’s impossible to address how to install this code on all 11,000 WordPress themes in existence, if you have a specific scenario, you’d like my feedback on, leave a comment at the end of this post.

Install GTM on your site the fast way – Use a plugin

There are several WordPress plugins you can choose from to help you install GTM.

My personal favorite is Google Tag Manager for WordPress by Thomas Geiger. I’ve used this plugin for years. It’s well supported and has over 300,000 active users.

GTM for WordPress Plugin

Installing GTM on a brand new WordPress Site (in 5 minutes or less)

With all the necessary context and background information out of the way, let’s get to work and install GTM on our WordPress site!

(FYI – If you’re setting up your site from scratch I recommend Kinsta for your WordPress hosting.)

The first step in the installation process is to set up your Google Tag Manager account.

When you create your account, Google will ask for your company name, and they will ask you to name your GTM container.

Your “container” is the virtual instrument that holds all your website tags. So you can think of this container literally like a box that stores all your website tracking code.

Next, you’ll want to choose a platform for your GTM installation. Since we’re specifically doing this install for WordPress, you’ll select “web.”

Setting up a Google Tag Manager Account

After you’ve completed your setup, you’ll arrive at the workspace screen for your GTM account.

GTM Workpsace

And by clicking on your account ID (in your workspace menu), you’ll be able to access your tracking code.

Google Tag Manager Tracking ID

Google Tag Manager Code

Using the Google Tag Manager for WordPress plugin

Now, if you haven’t already, you need to install the Google Tag Manager for WordPress plugin.

Once you’ve located the plugin in WordPress, install and active it on your site. After, you’ve activated the plugin, navigate to the plugin settings

In the settings area, you’ll see a place to enter your GTM account ID. Copy your ID from GTM Workspace and paste input it into the field that says “Google Tag Manager ID” in your plugin.

Enter your GTM tracking ID in the GTM For WordPress plugin Next, you need to select the type of installation you want to perform.

The simplest way to complete your installation is to use the “Codeless injection.” I use this method often, and (as far as I know) it has never caused harm to any of my websites.

Also, if you’re installing GTM on a brand new website, there’s little to no risk of breaking anything.

Codeless GTM Installation using the GTM for WordPress plugin

(If you are concerned a codeless injection will break your site, you can also use the custom method. The custom method requires you to add an additional line of code to the body of your theme. This code is referenced in the plugin documentation.)

For a codeless injection, all you have to do to finish your installation is save your settings…

And just like that GTM should be live on your site!

But how can you verify your installation woked?

Verifying your GTM installation was a success

To verify your GTM installation worked, you can use a handy little Google Chrome extension called Tag Assistant.

Google Tag Assistant

Once you have Tag Assistant installed in your browser, enable the extension.

Then, with Tag Assistant enabled, check your site.

If your installation was a success, your GTM tag should show up in your Tag Assistant report.

Verifying your GTM installation in Tag Assitant

Since you just completed your GTM install, you’re likely to see a notification in your Tag Assistant report that says you don’t have tags firing yet. And that’s because right now you have an empty GTM container.

So whaddya say we put some tags in that container?

Start tagging your site

To start tagging your site, go back to your GTM workspace, and select the “New Tag” button.

Adding new tags in GTM

Then, click the tag icon in the middle of your tag configuration screen…

create a new tag in GTM

And you’ll see a list of all the possible tag templates you can choose from to start tagging your site.

Tag Templates in GTM

Using tag templates in GTM

Tag templates are like a preconfigured bits tracking code you can install on your site using GTM.

These templates are how you’ll add tags to your site without touching your code.

If your Tag Manager container is empty, probably the best tag to start with is the most utilized and versatile tag template, Google Analytics.

Adding your Google Analytics tag to your WordPress site

To add your Google Analytics tag to your site, select the Universal Analytics tag from the tag template menu.

Universal Google Analytics GTM Tag

Configuring your Google Analytics settings variable

Within the settings of this tag, you can create your Google Analytics settings variable.

Your Google Analytics settings variable is like a holder for your Google Analytics tracking ID and any other custom settings that apply to every GA tag.

Enabling this variable will save you from having to look up your tracking ID every time you want to create a new Google Analytics tag. And there are a lot of different types of Google Analytics tracking tags you can add to your site. So enabling this variable now can save you hours down the road.

To configure this variable, simply select the “new variable” option.

Google Analytics Settings Variable in GTM

Then, in your variable configuration screen, enter your Google Analytics Tracking ID.

Configuring Your Google Analytics Settings Variable

Next, give your variable a name and save it.  Voila, 15 seconds that will potentially save you hours of future frustration.

With your settings variable enabled and selected in your tag, you can finish configuring your Google Analytics tag.

Adding a trigger to your tracking tag

For your tag to fire (record hits in Google Analytics), you need to give it a trigger.

To set up your trigger, select the trigger configuration icon.

Creating a Trigger in GTM

Then from the triggers menu, select the page view trigger…

Google Tag Manager Page View Trigger

And set it to fire on all pages of your site.

Fire your GTM Trigger on All Pages

Finally, you can name your trigger and save it.

After you have your trigger in place, you need to name and save your new tracking tag.

Previewing and verifying your tag

The final steps in your Google Analytics tag setup are to verify and publish your tag.

To verify your tag, go back to your GTM workspace and hit the preview button to activate preview mode.

Preview Mode in Google Tag Manager

Then, go to your site and refresh your browser. After your site reloads you should see your Tag Manager preview screen in the lower portion of your browser.

And, if you installed your Google Analytics tag correctly, your preview screen will display that your tag fired when you refreshed your browser.

Previewing GTM Tags

You can also verify your Google Analytics tag installation using Tag Assistant.

Verifying Tag with Tag Assistant

And you can double-check that your page view was recorded using your Realtime report in Google Analytics.

Verifying your GTM tags in Google Analytics Real Time Reports

Now that you know your Google Analytics tag is firring correctly, there are just a couple more steps to push this tag live on to your site.

Publishing your Google Analytics tag

First, you want to make sure you don’t double up your Google Analytics tracking code… meaning if you manually installed your Google Analytics tracking script on your site before you executed your GTM installation, you need to remove your old code. You don’t want to add your GA tag manually while also firing the tag from GTM. That mistake will result in double-counting your site traffic, which will inflate your Google Analytics reports with false data.

Finally, you need to publish your container. Although you can see the tag you created in preview mode, it isn’t live on the web yet. So you need to submit the changes you made to your container before your tag will start tracking the traffic coming to your website.

Publishing GTM Tags

A quick recap

I hope you enjoyed my 5-minute GTM for WordPress Guide (as well as the bonus information I covered about installing your Google Analytics tag).

You can learn even more about how to use GTM to track your website (and download more of our FREE resources) on our Google Tag Manager Marketing Hub.

And, you want to learn how to collect the type of data that can have an immediate impact on your website conversions, check out our Tag Manager Mastery program.

Here’s a quick review of everything we covered in this post:

  • GTM helps you manage your tracking tags in one place
  • It’s especially easy to install GTM on WordPress with a plugin
  • Installing Tag Manager won’t do anything until you add tracking tags to your container
  • Start with your Google Analytics to make sure your tracking works
  • Remove any previous Google Analytics code/plugins you had in place before installing Google Analytics via GTM

Questions and comments

If you have questions about your GTM installation or recommendations for using GTM with WordPress, leave a comment below.

The post Google Tag Manager for your WordPress site – The 5-minute Guide appeared first on Jeffalytics.

Read more

Google Tag Manager for your WordPress site – The 5-minute Guide
Scroll to top