Learn how to install Google Tag Manager for WordPress and how to link your Google Analytics account.
Take the example of a site that runs on WordPress. We will create a Google Tag Manager account as well as Google Analytics to track page views of the site.
Create a Tag Manager account
First, we will be redirected to a page to create an account. We are then invited to fill in several fields of a Google Tag Manager form:
Now click on To create, accept the terms and continue.
After that, a window will appear with the snippets that we will need to insert into our website code. But since we’re going to be using a plugin, we only need the container ID, which we’ll need later, so we can close this window for now.
First, let’s add the Google Analytics tag and publish the container.
Create a Google Analytics tag
To begin, we will retrieve the Google Analytics tracking ID, and configure it in Google Tag Manager, so that it sends the desired information.
In the Administration gear at the bottom right, then in the column Property, click on Tracking Information then tracking code.
Now let’s go back to Google Tag Manager.
In the left column, click Variables, then click News.
We can name the variable “GA Parameter”. Then select Google Analytics Parameter, and paste your Analytics tracking ID.
We can click Record.
Now we will create a new tag and name it GA – View Page.
Click on the area Configuration tags and select the type of tag Google AnalyticsUniversal Analytics .
Select page view, like tracking type.
For the trigger, you can choose default All Pages. Google Tag Manager’s page view triggers allow tags to be triggered when pages are loaded in web browsers.
Now we can record and publish the container!
Always add a version name when publishing a container. This helps everyone understand what has been done to the container.
How to Install and Configure the Google Tag Manager Plugin for WordPress
Find and install the plugin on WordPress
Now that our container is ready, we can return to our WordPress site. Let’s go to the admin area and add the Google Tag Manager for WordPress plugin.
We will navigate to Extensions and click on To add.
Look for it: Google Tag Manager for WordPress by Thomas Geiger.
Click on To install, then when done, click Activate.
Configuring GTM plugin settings
Once our plugin is activated, let’s go back to our plugins area and go to the Google Tag Manager plugin settings for WordPress.
The first thing we need to do is add our Google Tag Manager ID.
Adding your Google Tag Manager ID
To recover your Google Tag Manager ID, return to your account and you will find your GTM-XXXXXX ID in the bar at the top of the page.
The plugin does the heavy lifting and adds these pieces of code to the head section and the body section of your pages. We just need to give the plugin the Google Tag Manager ID and it will take care of the rest.
We can now go back to our plugin settings in the admin area, paste the ID and save the changes.
Testing the proper functioning of the plugin on WordPress
Now, let’s verify that the Google Tag Manager container has been added to the website. Let’s navigate to the Google Tag Manager workspace and preview the container.
We should be able to see the GTM Preview mode like this:
This shows that the Google Tag Manager container has been added to this website and is loading on this page. Our GA-Page Vue tag was activated once, which is good.
We can also go to the Google Analytics Live Preview interface and check the real-time display to make sure that Google Analytics actually receives the result that was sent to Google Tag Manager.
If you just want to use this plugin to add the Google Tag Manager container in your WordPress or eCommerce site, you don’t need to do anything else. It runs and works reliably.
But the real power of this plugin comes from all it can do other than injecting a Google Tag Manager container on your website. It can actually put many kinds of useful information into the data layer. We will find out about this in another article.