Are you planning to add more tracking codes to your website? If the answer is yes, then you should start using Google Tag Manager. In this tutorial, I am going to show you how to easily install the Google Tag Manager, and how to add Google Analytics tracking code via Tag Manager. It is easy to follow tutorial for beginners.
Why You Should Start Using Google Tag Manager?
It is quite a useful tool to deploy codes without actually worrying about breaking things up on your website. Let me explain why you should start using Google Tag Manager:
- Once you paste Google Tag Manager code on your website, you won’t have to add tracking code snippets directly on your site. You will only be using Google Tag Manager interface to add tags.
- Google Tag Manager is quite easy to use. However, you have to learn how to use it properly.
- You can actually debug tags before applying them to your tag manager. You can do that by using tag assistant extension. I will cover that in later part of this tutorial.
- You can also use Google Tag Manager to install third-party tracking codes such as Facebook Pixel, Quora Pixel, and many more such advertising programs.
Requirements for this tutorial:
- Google Account
- Website Login Access
How to Set up Google Tag Manager on Your Website?
It is a fairly simple process. You can also verify Google Analytics Property using this method.
Step 1: You need a Google account in order to use Google Analytics and Google Tag Manager. So, if you don’t have one then create a Google account.
Step 2: Login to Google Tag Manager. Once you are there, it will ask you to create an account.
Add a New Account
Add Account Name: You can enter your company name, personal name, or a website name.
Select a Country:It is self-explanatory. Select your country from the drop-down menu.
Share Data anonymously with Google and others: If you mark this field, Google will send your website data anonymously to its other programs such as Google Trends, Adwords, etc.. It is an optional field. So, you can leave it unchecked.
Container Setup Process
Container name: give any memorable name to your container. It could be your website name or domain name. This field is important if you plan to create multiple containers in the future.
Where to use container: You can select any of the given options. In my case, I am going to use the Tag manager mostly on my website so I will select “Web”.
Now, click on the Create button. It might also show you terms of service agreement, read it and click on Yes.
Install Google Tag Manager Script on Your Website
You will be seeing a new page with a script that you have to place inside the HTML <
head> tag. And the second one at the start of the <
On multiple content management systems such as Wix, Squarespace, Shopify, Joomla, and Drupal, there is usually an option to add scripts inside the head and body tags. You can read my post on how to add Google Analytics to Wix, Shopify, and WordPress.
Since WordPress is the most popular content management system, I am going to share with you a simple process of how to install the Tag Manager in WordPress.
Install Google Tag Manager in WordPress Using a Plugin
There are multiple ways to install Google Tag Manager on a WordPress site. Since this tutorial is for beginners, I am going to use the simplest one.
Step 1: Download Insert Headers and Footers plugin and install it on your website. Remember to click on the activate button once the installation is finished.
Step 2: Go to your WordPress settings option and click on the “Insert Headers and Footers” link.
Step 3: Go back to your Google Tag Manager and select and copy the code for the <
head> section. Now, paste it inside the plugin’s <
Step 4: Similarly, copy the code for body tag by going to Google Tag Manager and paste it inside the body section. Save these settings.
How to Check if Google Tag Manager is Correctly Installed?
Download this Google Chrome extension Google Tag Assistant. Make sure that you are using the Google Chrome browser.
Once you install this extension, you will see a little symbol at the top right corner of your Chrome browser. When you click on it, you will be able to see all of the tags that are firing on your website.
Now, that you have installed the tag manager scripts on your site, it is time to check if it is working correctly.
Go back to Google Tag Manager, Press Ok.
At the top right corner of your Tag Manager account, you will find a ‘Submit’ button. Clicking on it, will pop-up a new window.
In the version name field, type anything memorable which will tell you about the changes you made. Give it a name such as Google Tag Manager Installation.
In the second form field, you can add more details about those changes. Using these fields will come handy once you have to revert some changes in the future. So, I would suggest you to always add the version description whenever you make changes.
In this particular scenario let’s enter something like “Installation of Google Tag manager on the website”. Click on the Publish button.
Now, we will check if the installation is working correctly or not.
Click on the little Google Tag Assistant extension symbol at the top right corner. Press the Enable button.
Reload your website homepage where you have installed Google Tag Manager code. Now again, click on the Tag Assistant extension symbol.
If your installation was correct then you will see a result like in the screenshot above. If not then you should check if you have correctly installed the Tag Manager scripts on the website.
How to Install Google Analytics through Google Tag Manager?
Now that you have created a Tag Manager account, it would be much easier to install any scripts and tags on your website. Let’s see how we can install the Google Analytics tracking code through Google Tag Manager.
If you don’t already have an Analytics account then you need to create a Google Analytics account for your website. Let’s first create a Google Analytics account.
Visit the Google Analytics website and click on the signup button.
Account Name: You can give it any name. In this scenario, I am going to give it a name such as Azib’s Personal account.
Website Name: Type a name of your website here or any identifiable name.
Website URL: This is where you will type your domain name. Make sure to check the correct protocol from the drop-down menu. You can use either HTTP or HTTPS.
Industry Category: Select any industry in which you think your website fits nicely.
Reporting Time Zone Select the country where you live in, and wants Google Analytics to report your data according to that time zone.
You will see a tracking code on the next page. If not then you can find your tracking ID by going to Admin > User Management > Tracking Code.
We are only going to copy the Tracking ID from the top of the page. This is what we are going to add in our Google Tag Manager later.
Log into your Google Tag Manager account and click on Add a new tag.
It will bring a new window. Give your tag any memorable name. I have given it a name “Google Analytics All Page Views”. Now, click on the Tag Configuration tab below.
Select Google Analytics – Universal Analytics when it asks for choose Tag type.
It will bring some new options. In the Track Type, select Pageview. In Google Analytics Settings, select a New Variable.
It will open up another window. In the first option Tracking ID enter the Google Analytics Tracking ID which we copied earlier. In Cookie Domain, keep it to auto. Press the Save button at the top right corner. It will ask you to give this new variable a name. You can give it any identifiable name, I am going to use the Analytics tracking code as my variable name.
Now, you have to add a Trigger so that this tag will fire when the conditions meet. Click on the Triggering Tab.
Select All Pages as a trigger. Click on the save button at the top right corner.
You can debug this tag via preview mode before submitting this new tag to your container. Click on the Preview button. It will reload the Google Tag Manager page.
Visit your website (where you have installed the Google Tag Manager). Reload the page, and you will find Tag manager debugging tool at the bottom.
Below the Tags Fired on this page heading, you will see the tag name that has been fired on this particular page which means, your Google Analytics tracking code is working correctly.
If you don’t see your tag name here then there must be something wrong with the tag configuration. You should check where you made a mistake.
Now that we have tested our tag and we know that it is triggering on all website pages. We will go back to the Tag Manager and click on the Submit button.
It will ask you to give a version name, you can type something that will remind you what changes you made. So, I am going to type something like Installed Google Analytics Page View Tracking Code.
If you want you can also add more description, and click on the Publish button.
Our Google Analytics code is installed on the website via Google Tag Manager. Now, you will be able to see traffic coming to your Google Analytics property.
Let me know in the comments if you have any questions regarding the Google Tag Manager setup. I hope you found this post useful.
If you want to improve your search traffic then check out my white hat link building services.