Google Tag Manager is a Google tool that have many inserting features for performance marketers, digital analysts and marketing data analyst.
So in this article I tried to explain how GTM works and talked about the technical information of this great tool.
What Is Google Tag Manager?
GTM or Google Tag Manager is a tool to manage websites and application tags which can be used for different purposes like data collection, service activation, remarketing ads and so on.
It means you can edit, add or remove codes on your website using GTM and you don’t need to have access to your website code. You can easily manage codes and scripts running in your website.
Key Concepts in Tag Manager
Before starting to learn and check out how to work with GTM, you need to be familiar with the key concepts in Tag Manager.
So I provided a list of concepts you need to know.
Tags
are snippets contained in a website’s code that can generate cookies when a user does something the tag has been instructed to measure. For example, a conversion tag, like conversion.js, might generate a cookie when a user makes a purchase. Tags typically end with “.js” because they’re usually written in Javascript.
Using tag you can create events and pass data to Google Analytics Universal or Version 4 also known as GA 4.
You will be able to see the data in GA reports and you can even export them to GDS or Google Data Studio to create dashboards.
Trigger
Triggers are used to fire the tags under certain rules and circumstances, Tags won’t work if the trigger doesn’t match the rule it is defined to run for. For example a conversion tag works only and only when a defined conversion triggers. Depending on what you want to track, you can set triggers for different things. For example, if you want to track a specific action as a conversion action, you can set a trigger to fire a tag when that specific action takes place. It can be a purchase, sign up or anything you think is important to be labeled as a conversion.
Variable
Triggers and Tags can contain elements called Variables.
A Variable is a placeholder that contains a value.
Let’s see an example: {URL} equal to alishafaghi.com
In the above example, “URL” is a variable, ”equal” is an operator and “alishafaghi.com” is the value assigned to the variable URL.
So, every variable needs an operator and a value.
There two types of Variables in GTM:
- Build-in Variables : Variables that are already created and you can use them by assigning values to them
- User Defined Variables: Variables that you can create using Data Layer
Data Layer
DL or Data Layer is a Javascript object that can be used to pass data to GTM.
Using DL you can create User Defined Variables and by using User Defined Variables you can create custom tags and triggers to track different elements because sometimes the data you are looking for, can’t be collected using Build-in Variables and that’s where DL will help you to create new ways to track different elements and collect data.
Cookies
are small text files generated when a user visits a website. A cookie records how a unique user interacted with the website that placed the cookie. First-party and third-party cookies mainly differ in how they’re generated and stored.
First-party cookies
are generated and stored by the website a user is visiting. Historically, their main job has been to streamline user experience within the website, for example, by keeping users logged in and remembering which items they put into their cart. Newer systems use first-party cookies for measurement because they’re more reliable.
Third-party cookies
are generated and stored by domains other than the website a user is visiting. Historically, they’ve been behind measurement or marketing efforts that happen on pages outside advertisers’ websites, like remarketing. Due to the changing privacy ecosystem, third-party cookies are becoming less reliable.
Dynamic Tagging
Dynamic tagging solutions use first-party technology to make sure that various Google products can measure conversions more accurately. And accurate conversion tracking is the first step to insights you can count on.
GTM Dashboard Sections
- Workspace: is the main section of GTM in which we create tags, triggers, variables and so on.
- Versions: in this section we will have a list of all changes we made and published to our site. You can see who did the changes and you can cancel the changes.
- Admin: in the admin section area, you will access account settings, container settings, you can import and export containers and so on.
How Does GTM Work?
I’m not going to talk about what is happening in back end codes, I just want to tell you how GTM uses tag, trigger and variable to track elements and collect data.
So, as I explained above, you should be familiar with tag, trigger and variable concepts.
In general, a tag is what you want to happen (ex: creating an event to track an element) and a trigger is when you want that thing to happen (ex: when a user clicks on a specific CTA).
Tags and triggers can be created using variables, although you can create tags without using variables but to create triggers you must use variables.
So in GTM when you create a tag to do something, you need to create triggers to tell GTM when that tag should be in play and to do that you must use some variables.
Let’s see some examples for each.
Tag Examples:
- An event to track sign up
- A HTML script to run online chat on website
- An event to track video plays
Trigger Examples:
- Pageviews on all pages
- Clicks on CTA with id equals to “buy now”
- Pageviews with page path equals to “thank you”
Variable Examples
- Page URL
- Click ID
- Form ID
Now I want you to see an example containing all those elements.
Example: Let’s say I want to track how many users clicked on the “buy now” button in the home page. So this is how I track it.
Note that I’m not trying to teach you how to create a tag in GTM because that needs many technical tips which I will explain in another article, the goal is to show what a tag looks like in GTM.
I will create a tag for an event in Google Analytics and I will name its category CTA data home page and I will choose click as the action and click text as the label.
Then I’ll go to my website and right click on the button and I choose the inspect element in chrome, then I look for the id attribute for the a tag and I will copy it.
I head back to GTM, next I will go to the triggers section and I click on new. Then I will choose the Just Links option and in the next page I choose some clicks. In the variables list I will choose Click ID and I will choose equal operator and lastly I paste the ID that I copied from my website there.
And then I test and debug my tags and finally I will publish it.
Why Using GTM Is Crucial for Performance Marketers?
As a performance marketer you need to be able to track every marketing effort and check out the results and effectiveness of each channel, besides that you need to monitor users behavior to find out their needs and problems they face when using your websites or app.
If you don’t track these things, and you are still advertising and selling online, it’s like driving a supercar with closed eyes!
So, don’t do that and open your eyes. 😀
When you start to measure everything, you will be able to see what’s working and what’s not, which items should be added to your menu or which section should be removed or changed from your home page and so on.
It’s very necessary to collect data and analyze it to see if you need to change something because it can increase the effectiveness of that thing.
GTM is a tool that will help you collect data and track almost everything that happens on your website or application.
With GTM you can track things like scrolls, clicks, impressions, form submission and so on.
But, GTM does not give you any data directly, you need to use other platforms like Google Analytics to receive the data in the format of reports and dashboards.
How to Use GTM?
First you just need to have Gmail and just search Google Tag Manager in Google and go to its dashboard.
To use GTM you just need to copy the GTM script code and paste it on your website code in the <head> section.
If you want to learn how to set up GTM check out my article on that.
Then you need to activate your GA or Google Analytics to receive the data that you collect with GTM.
To do that you need to open up a GA account and connect it to your GTM and using GTM your website data will be sent to your GA account.
If you want to learn how to set up GA using GTM check out my article on that.