How to Install and Use Google Tag Manager in WordPress

Posted on September 22nd, 2022

Google Tag Manager is a tool that allows website owners to tag their pages with custom variables which can then be tracked and monitored. Google Tag Manager can follow events on a website, such as when users click or interact with particular elements on the page. It can also be used to track how users move through the site and to set up custom events that are triggered based on user behaviour. Using Google Tag Manager, you can create variables that uniquely identify your content so you can easily track things like clicks, impressions, and conversions. You can also create variables that automatically trigger tags when certain conditions are met. An example is when a user downloads an item from your e-commerce site or completes an in-app purchase. While web developers most commonly use Google Tag Manager, it can also be used by non-developers who want to measure campaign performance and analyze data from their web properties.

GTM works with any Web Technology, like websites, web apps, and applications like iOS and Android. We need to create an account and configure it based on your needs. It also integrates with other tools like Google Analytics and AdWords so that you can track data in one place. You can configure tags to track everything from user behaviour to server performance. So, let’s briefly understand Google Tag Manager and how it works with WordPress. 

History of Google Tag Manager (GTM)

GTM was first introduced in 2013 and has become one of the most popular tools for web tracking. Today, it is used by many website owners to simplify their Google Analytics setup process. Google initially developed GTM to simplify tag management within their Analytics platform. However, it quickly became popular with other website owners as a way to simplify tracking across multiple websites. GTM is now supported by almost every central analytics platform, including GA, Omniture, and Adobe DMP.

GTM is primarily used for tracking web traffic. Still, we can also use it for other purposes, such as optimization and advertising campaigns.

In 2016, Google released GTM 2.0 as an open-source tool to enhance the reliability of creating tag instances on multiple pages in a single view. In 2017, Google released GTM 3.0 as an improved version of their Tag Manager product with additional features such as the ability to work on multiple domains and better support for JavaScript libraries and APIs.

Configure the Google Tag Manager account

The Google Tag Manager(GTM) allows us to collect all the important traffic and user behaviour details. We can track each user and analyse our website content using simple code. GTM provides these lines codes, which we need to integrate into our WordPress websites. But first, we must own a Google Tag Manager Account and configure it based on our requirements. Then, GTM will display some lines of code with instructions on how to use them on our websites and apps. So, in this article, we will learn how to create a Google Tag Manager Account and catch the code we need to use on WordPress. Follow the steps from here to create a GTM Account. 

Step 1: Click here to open Google Tag manager in the new tab.

Step 2: You can skip to Step 4 if you are already logged in. Enter the E-mail address to log in.

Step 3: On the next page, enter your google account Password on the password field, as you can see in the image.

Step 4: After your successful login, you will redirect to the main screen with two tab sections Accounts and Google Tags. Here, click on the Create Account button available on the right side of the screen, as you can see in the image here. 

Step 5: The first section of this form is Account Setup. Within this section, we have two fields: Account Name And Country, which contains a drop-down. Enter your account name into the Account name field and select your preferred country from the country drop-down as shown in the below image. You can enter your website name or project name.

Step 6: Then, scroll down to the next section available as Container Setup. This section has the first field as Container Name, which means how we want to use these tags. We’re creating this account to use on our WordPress website. So, enter your WordPress website’s URL in this field.

Step 7: The next section is a choice section. As we discussed, we will use the generated code on the WordPress website. So, we have to select Web, which is the first option from the list. We can create separate containers for specific technologies like iOS and Android, AMP, and Servers. Then click on the Create button, as shown in the image below. 

Step 8: The form has an Agreement that shows Terms and Services. Please scroll down and find the I Agree checkbox, which is available in the last. Click on the checkbox and mark it as true. See the below image as a reference.

Step 9: Then, click on the Yes button, which is available on the screen’s top right side, as shown in the image below. 

Step 10: You will redirect to the Google Tag tool after completing the process. It will open with a couple of containers with some code lines, and you can directly copy them, or here we mention how we can find the code snippet, which we have to paste on the WordPress website. Here, you can see a Tab Section on the top left side. Click on the Admin tab section, as seen in the image below. 

Step 11: On the next screen, two main sections are available, as you can see in the image below. Find and click on the “Install Google Tag Manager” section from the left-sided options, just like the image here.

Step 12: You can see both Code Snippets with a copy button. We have to copy them both from here. To Copy them, click on the Copy icon on the top right side of the Snippet Box. See the below image as a reference. 

Congratulations, we just successfully created a Google Tag Manager account. Then, we also learn how to find the Code Snippets from the Google Tag Manager tool.

Add Google Tag Manager Code to WordPress

We just learned how we could create a Google Tag Manager account. Now we are going to add the code snippet in our WordPress site. We have two types of Code Snippets. Use the first code on the Head Section of the website. We will add the second part of the code to the Body tag section of the website. To simplify the process in WordPress, we are going to use a plugin to add code snippet on our WordPress site. This is specially helpful if you are a non-technical person.

Add code snippet in WordPress using WP Headers and Footers Plugin

Step 1: Goto your WordPress website Admin Area and log in through your username and password

Step 2: Then hover your cursor on the Plugins tab section available on the left side tab opinions. Then click on the Add New option as shown in the image below.

Step 3: On the Add Plugins page, Find and click on the search field on the screen’s right side. Then search for “Insert Headers and Footers” and find the correct plugin for the search results. After finding the right plugin, click on the Install Now button, as seen in the image below. 

Step 4: Once you install the plugin, the Install Now button will change with the Activate button. We have to activate the plugin to start using it. Click on the Activate button, as you can see in the image below.

Step 5: We just successfully installed a Headers and Footers plugin. Here, hover your cursor on the Settings tab section and then click on the WP Headers and Footers tab option, which is the last option of the settings tab. See the below image as a reference.

Step 6: Here are some text areas for the Header, Body, and Footer on the next page. The Header text area will add all the code written on this text area to the website’s header section. Just like the Header section, we have the Body section, which helps us to add the code snippets to the Body section of the website. See the below image as a reference. 

Step 7: As we discussed in the tutorial, we need the codes provided by Google Tag Manager here. Paste the first code snippet on the Header section and Paste the second code in the below Body section, as you can see in the image.

Step 8: After adding the code in the text areas, scroll down and click the Save Changes button to save all the settings. See the below image as a reference.

Congratulations, you successfully added Google Tag Manager Code snippets to Our WordPress websites. Now, let’s learn how we can add new tags for better analytics of our page views using Google Analytics. 

Adding New Tag in Google Tag Manager

Google Tag Manager allows us to use many different features and tools like Google Analytics, Google Ads, Google Optimise, Conversion Linker, Custom HTML Code, and many more. GTM has a list of external tools we can integrate easily with Google Tag Manager. So, in this article, we will show how we can add new tags to use different software and retrieve valid data per your needs. It’s an easy process, and here we show you how to add Google Analytics tags within the Google Tag Manager and retrieve the PageViews. Follow the steps from here.

Step 1: Goto the Google Tag Manager tool and log in through your Google Account as discussed in the tutorial. 

Step 2: Click on the New Tag option available on the Dashboard. See the below image as a reference. 

Step 3: As you click on the Add New Tag option, you will see the New Configuration and New Trigger section slide from the right side of the screen. Add the Configuration name on the top section and then click on the Tag Configuration or First option, as you can see in the image below. 

Step 4: As you click on New Configuration, You will see a list of Tag Types that we can use to add new tags. This tutorial will add a new tag for Pageviews using Google Analytics. So, click on Google Analytics: Universal Google Analytics to select the service type. See the below image as a reference.

Step 5: After selecting Google Analytics from the list, we must choose the Track Type. So, click on the drop-down and select your preferred Tracking Type. It has many options like Pageviews, Events, Social, Timings, etc. see the below image as a reference. 

Step 6: Then, just below the Track Type, we have another drop-down menu called Google Analytics settings. Click on the drop-down and select New Variable, as seen in the image below. 

Step 7: Here, we have to add the Google Analytics Tracking id on the New Variable page. To find a Google Analytics Tracking ID, open a new Tab Window and login into your Google Analytics account. Once you redirect to the Dashboard of Google Analytics tool, click on the Admin settings tab option, as you can see in the image below.

Step 8: Here, we have three different sections on the Admin Settings page. Find Tracking Info in the middle section and click on it. Then click on the Tracking code, as seen in the image below. 

Step 9: On this page, you will see the Tracking ID at the top. Copy that tracking code.

Step 10: Now, come to the Google Tag Manager and Paste the Tracking ID in the first field on Adding New variable. See the below image as a reference. And then click on the Save button available on the top right side of the screen. 

Step 11: Now, we also have to add a new trigger so it can make this tag fire and catch Analytics. So click on the Triggering section, as seen in the image below.

Step 12: On the trigger page, click on the first option called All Pages. So this tag will fire on all the pages of your website. We can even select specific pages also. See the below image as a reference. 

Step 13: And then click on the Save button available on the top right side of the screen to complete the set up.

So, this is how you can use Google Tag manager with WordPress. The process is easy and does not require any technical knowledge. We hope you were successful at setting up tag in your website just by following this tutorial. For any questions and queries, use the comment section given below. We are happy to help you.

Leave a Reply