MeasureSchool logo
Search
Close this search box.
Search
Close this search box.

The Google Tag Manager Tutorial for Beginners

Last Modified on February 27, 2024

Are you new to Google Tag Manager but want to learn what GTM is all about and how to use it?

Google Tag Manager is a powerful tracking tool that is used by almost all digital marketers. 

GTM For Beginners

Sign up to the FREE GTM for Beginners Course...

In this Google Tag Manager tutorial, we’ll learn what GTM is all about and how to effectively use it for tracking purposes.

An overview of what we’ll cover:

Let’s dive in!

How Google Tag Manager Works

Google Tag Manager is an all-in-one Tag management system that allows us to integrate all our tracking needs into one user-friendly interface without constantly implementing various codes on our system. 

You can install the scripts manually by adding pixel code to the website. These are known as the marketing Tags

Installing the Pixel codes to the website script

You can also access your code editor to customize the script according to your needs. You can also have an overview of all the codes installed on your website from this code. 

Customizing the website script to manually add codes to track pageviews by users

However, Google Tag Manager eliminates this need to implement various codes. You can simply install the central snippet of Google Tag Manager on your page.

Accessing Google Tag Manager snippets to manually install them to the website script

After implementation of the code, all your Tags can be managed through the graphic interface of the Google Tag Manager system. 

Analyzing the graphic user interface of the Google Tag Manager account

You simply need to configure the data that you wish to track and create triggers for each data set. Triggers are the rules that define intervals or times at which your Tags get fired. 

Finally, you can configure the Tag and send it over to the marketing vendors. After successfully deploying the Tag, GTM implements your tracking codes in the background. 

In addition to this, there are several advantages of using Google Tag Manager. 

You have a version control system that allows you to control any published changes on your website, a preview mode to test your Tags before they go live, and a management function that helps to monitor everything. 

Overall, this is a more flexible and granular way to organize your marketing Tags. 

We’ll learn about more of such functionalities as we move forward in this guide. 

GTM Overview

Let’s learn the basic overview of GTM with the help of an example. 

Before we start with the example, let’s understand the prerequisites for setting up GTM Tags

As we mentioned earlier, we’ll need to install the GTM code scripts into our account to implement codes on various tools like Google Analytics or Facebook.

So we have the Global Site Tag script from Google Analytics that we can install on our website.

Accessing Global Sit Tag snippets to manually install them to the website script

For demonstration purposes, we have created a demo website that we’ll use to configure our Tags. 

We have already configured Global Site Tag and Facebook Pixel to the website. You can access the configured scripts from the Google Tag Assistant extension of the browser. 

Accessing the configured codes to the website from the Google Tag Assistant legacy extension

Open the source codes of the website by right-clicking on the website tab and navigating to the View page source

Viewing the page source to access the source codes of the website

If your configuration is successful, you’ll be able to see the Facebook Javascript code as well as the Global Site Tag installed on the source code.

Analyzing the code snippets from the page source of the website

Following is another demo website created for the purpose of configuring Tags. Let’s open the source code for that website. 

There aren’t any excess codes added to this website. We can only see one snippet for Google Tag Manager. 

Analyzing the Google Tag Manager snippet from the website source code

This is what Google Tag Manager is really all about. It eliminates the need to configure various tracking codes. 

Henceforth, we can deploy all our various tracking codes and Tags through this all-in-one central management interface called Google Tag Manager. 

Open the Tags section on your Google Tag Manager account. You’ll find all the Tags that you deployed for your website in one single place. 

Accessing various Tags from the Tags section in the Google Tag Manager account

When you open a Tag, you’ll realize that all of the Tags are implemented in the form of templates, not codes. 

You can see the Tags on a visual interface and configure them accordingly. 

For example, we have a Facebook Pixel Tag configured on our website. All we need to do is add a Facebook Pixel ID, and we can implement this Tag. 

Configuring a Tag with Facebook Pixel type configuration

Similar to the Tag interface, Google Tag Manager brings various other functionalities that can ease the process of Tag implementation. 

One such feature is the preview option. 

Preview Mode

When you click on the Preview mode for your website, it will put your browser into a special mode that connects to your website. 

Entering the preview mode of the website to analyze tracking changes to the website

Hence, you can verify the Tags deployed on your website.

For example, the preview mode for our website shows the various Tags we configured to our website under the category called Tags Fired

Verifying the deployed Tags by Google Tag Manager from the Google Tag Assistant tab in the preview mode

Preview mode is especially useful for debugging, tracking or finding errors in our implementation. This is much easier than finding errors in the codes configured in our websites. 

This was just one feature provided by Google Tag Manager. Another such feature is called the trigger.

Triggers

As we mentioned earlier, triggers are the rules that define intervals or times at which your Tags get fired. 

For example, the triggers for the Tags on our website are on All Pages. This means the Tags we configured will deploy on all the pages of our website. 

Analyzing the trigger configuration of the fired Tags from the Google Tag Manager account

However, we can also add exceptions to the triggers that will allow our Tags to deploy only on specific pages or interactions.

Let’s understand this with the help of an example.

Suppose we want to track when someone clicks on the Add to cart option on our website. 

Selecting the add to cart option on the website to generate data for tracking

Open your Google Tag Manager account, and navigate to Triggers → New

Creating a new trigger from the triggers section of the Google Tag Manager account

Give an appropriate name to the trigger, and click on the Trigger Configuration to add a trigger type. 

Configuring an add to cart trigger from the Google Tag Manager account

This will give you all the different templates to create a new trigger. In our case, we’ll choose the All Elements type trigger. 

Selecting an all elements trigger to configure in the Google Tag Manager account

We’ll set the trigger to fire on Some Clicks. Configure the conditions as Click Text contains Add to cart

Save the trigger configuration. 

Configuring an add to cart trigger with custom firing conditions for some clicks on Google Tag Manager

We can now attach this trigger rule to our marketing Tags for tracking purposes. 

Let’s say we want to configure this trigger rule into our Facebook account. So let’s go to Tags → New and create a new Tag to configure this trigger. 

Creating a new Tag from the Google Tag Manager account

Add an appropriate name to the Tag. 

Similarly to a trigger, we also have various types for a Tag template. Let’s choose the Facebook Pixel as the Tag type. 

Choosing a Facebook Pixel type Tag configuration from Google Tag Manager

You’ll need to configure your Pixel ID by going to the Settings section of the Facebook Business Manager account. 

Accessing the Facebook Pixel ID from the settings section of the Facebook Pixel account

Paste the Facebook Pixel ID to the Tag. As the event type, let’s choose AddToCart under the Standard category. 

Configuring the Facebook Pixel ID and the AddToCart event to a Tag in Google Tag Manager

Finally, we’ll configure our trigger. We’ll choose click – Add to cart as our trigger type. 

Once done, click Save

Configuring an add to cart trigger for the Facebook add to cart Tag in GTM

So that’s how we install our Tags and triggers! 

However, this version isn’t live yet. We can still edit and debug it in the Preview mode as we learned earlier. 

Let’s connect our website in the preview mode of our browser to verify our Tag implementation. 

We’ll choose a product on our website and click on Add to cart

Selecting the Add to cart option on the website to generate data for tracking user movements

This information is tracked in our Google Tag Assistant account, as well. 

Under the event of Click, our Facebook Add to cart Tag is fired. 

Verifying the fired Tags from the Google Tag Manager browser extension

Let’s also test our Tag before we make it live on our website! 

On the Facebook Business Manager, navigate to Test Events → Open Website

Entering the preview mode from the Test Events section of the Facebook Pixel account

This leads us to our demo website.

Reload the page and choose an item for the Add to cart event. 

This event will definitely be monitored by Google Tag Assistant. However, we want to verify the results with Facebook Business Manager, as well. 

Under Test Events, we’ll find our fired Tag for Add to cart

Verifying the fired Tags from the Test Events section of the Facebook Pixel account

Since the Tag is working as expected, we can publish this version on our website. It will deploy our tracking to the website for all our audiences. 

Remember: The best practice is to first create the Tags, and then verify them in debug mode before making any changes to the live website. 

Click on Submit to submit the current version of tracking. 

Submitting the current version of the Tags to publish it and make it live for other users

You can add a name to the version. Click on Publish once done. 

Publishing the current version of the Tags to make it live for the audience

Henceforth, all the users who click on the Add to cart button will be tracked through our implementation of the Facebook Pixel. 

One of the advantages of this setup is that you can always navigate back to your previous versions of tracking and restore them. 

Analyzing the live published version of the website from the Google Tag Manager account

This was just an overview to help you familiarize yourself with the tool to start your own tracking system. 

There is much more to Google Tag Manager. One of the major benefits is installing it on our website. 

How to Install Google Tag Manager onto Your Website

Let’s first open our Google Tag Manager account. 

First-time users will need to sign in to the account. You can sign in with any kind of Google account including your YouTube or Gmail account. 

In case you don’t have a Google account, you can create one instantly. 

We have a new demo account for the purpose of this lesson. Let’s click on Create Account, as this is the first time login with this account. 

Creating a new account for accessing Google Tag Manager

Google Tag Manager is made with accounts and containers. 

Adding account information to create a new Google account for Google Tag Manager

So, any account is simply a collection of various containers

Containers are the snippets that are installed onto our website. 

It is a good practice to use your company name as your Account Name in GTM. Next, you can add your country name. This is important for privacy reasons. 

You can also choose to share this information anonymously with Google. 

Configuring Data to a new account on Google Tag Manager

Let’s move on to containers. 

We’ll add our website URL as the Container Name in this case. It isn’t necessary to use the URL for the container name, but we have chosen our own conventional method. 

If you have multiple accounts or containers, it is always good to have your own naming convention systems for those accounts. 

Next, we’ll choose the Target platform. 

Ideally, you can install Google Tag Manager on Web, iOS, Android, AMP, and Server-side platforms. 

However, we’ll choose the Web platform for this tutorial. 

Click on Create once done. 

Creating the container set up for a new Google Tag Manager account

You’ll receive the terms of service agreement once it configures your information.

Read the agreement once, click the acceptance tick, and click on Yes if you wish to proceed. 

Accepting the terms to create a new GTM account

With this, we have set up the account portion of Google Tag Manager. 

Our next step will be to install the GTM snippets into our website scripts. This is very important for us to deploy codes through Google Tag Manager. 

Click on your GTM ID to access your GTM snippets. 

Accessing Google Tag Manager code snippets from GTM ID

You can also access those snippets through Admin → Install Google Tag Manager.

Accessing code snippets from Admin section of Google Analytics account

Let’s now configure these codes onto our website! 

Installing GTM Snippets Onto the Website

Snippets are extremely important for us to deploy codes through Google Tag Manager. 

These scripts will be the last codes we install onto our account, as henceforth, we’ll deploy all our Tags through the Google Tag Manager. 

There are two different types of codes in this script. One code is placed in the head section of the script, while the second code is placed in the body section of the script. 

Accessing the GTM code snippets for adding to the website script

We have a demo website for illustration purposes. Our demo website runs on the CMS WordPress setup.

Although WordPress is a widely accepted form of CMS, there are other CMS tools. Therefore, the installation process may vary accordingly.

For example, in WordPress, we can use the theme files, or plugin into our functions PHP, or install a plugin to configure Google Tag Manager to the website. 

But once our installation is complete, the outcome will be the same for all of the setups. 

Let’s open our website, and right-click on it to open View Page Source

Accessing the source codes of the website page

You’ll notice that the page script contains a header code for GTM at the beginning of the code. 

Analyzing the GTM code snippets from the website page source

Also, in the central region, you’ll find the body code for GTM. 

Analyzing the GTM body code snippets from the website source codes

There are various methods for executing this installation, but we’ll choose to add the codes to our functions PHP, as this is the most accessible method for all WordPress websites.

Login to the backend section of your website, and navigate to Appearances → Theme Editor.

Accessing the theme editor from the Admin section of the website backend section

You can choose the theme as Storefront Child Theme. This way, any updates on our main theme won’t overwrite the edits in this section.

Go to the Theme Header file. This is where we’ll add our changes to the script.

Accessing the theme header from the theme files section of the website backend channel

Let’s first copy our header code. 

We’ll place the header code below the opening head Tag. This should be as high in the code as possible. 

Configuring the GTM header code on the website source snippet

Next, we’ll copy the body code and place it below the opening body Tag. Click on the Update File after configuring the codes. 

Configuring the GTM body code on the website source snippet

Let’s inspect the HTML after installing the codes. 

Reload the website page, and again open the View Page Source section. 

Checking the page source codes of the website

If the configuration is correct, you’ll see the GTM code at the beginning of the script. 

Analyzing the page source codes of the website

Similarly, you’ll also see the GTM body code in the central section of the script. 

Analyzing the page source codes of the website

Let’s also verify the results of the script. 

Open the Google Tag Assistant Legacy plugin from your browser. You can sign in with the same account as you use for GTM. 

If the installation is correct, you’ll see Google Tag Manager on your plugin. Click on it to verify more details. 

Verifying the Google Tag Manager Tag analysis from the Tag Assistant legacy extension

If you see GTM in yellow color, it means the installation is incomplete. 

You’ll need to publish a version from GTM in order to make this into a green color. This is because although we have GTM installed on our browser, currently it’s not getting any data.

Analyzing the Google Tag Manager Tag analysis from the Tag Assistant legacy extension

Let’s solve this by going into Workspace and clicking on Submit to publish a version. 

Submitting a current version of the website to make it live for the users

This is just our initialization version. So we’re not adding any Tags or triggers to the setup, but we’re just verifying that our container is in ready-to-use condition. 

Add a Name to the version, and click on Publish

Publishing a current version of the website to make it live for the users

Let’s reload our website and verify the results in Google Tag Assistant Legacy. If the installation was successful, you’ll see that Google Tag Manager is now seen in green.

Analyzing the Google Tag Manager Tag analysis from the Tag Assistant legacy extension

Once we’re able to verify the results of Google Tag Manager from the Google Tag Assistant Legacy plugin, our next step will be to use the preview mode on our browser. 

This will put our browser into a special mode in which only our browser will be able to track the changes we deploy in the Google Tag Manager account. 

Click on Preview to enter the preview mode. 

Entering the preview mode of the website to verify changes made through Google Tag Manager

Add your website URL and click on Start

Entering the preview mode of the website to verify changes made through Google Tag Manager

This will open our website in a special mode in the new tab. 

Let’s navigate any page on our website. The URL changes for different pages. 

Analyzing the URL of the website to verify URL tracking

The Google Tag Assistant account will monitor these changes for us. 

Verifying the URL tracking from the Google Tag Assistant Tag on the browser

You can verify whether Google Tag Assistant is tracking all the pages reached by a user by opening all of your pages once. 

If there are any pages that Google Tag Assistant isn’t able to track, then it might be due to internal errors with your theme files or your plugin settings. 

It is extremely important for Google Tag Manager to track all the pages in order to deploy all of our codes successfully. 

Once you’ve verified all of the pages, you can exit the preview mode by clicking on the cross icon and choosing Stop debugging

Exiting the preview mode of the website from the Google Tag Assistant tab

This will also bring your website back to normal mode. 

So once the background work is complete, we’ll be able to install and implement our Tags.

How to Create a Tag Plan for Your Tracking Implementation

We’re going to take a look at how we can analyze the current implementation that we have on our web page. 

In order to have a complete view of the tracking systems, we’ll set up a tracking plan. 

This not only helps in organizing presentation plans for your clients, but it is also crucial for the development of your project. 

If you have a new joiner like a PPC manager on your team, this implementation of tracking plans will help him understand your goals in a simpler way. 

But the most important reason for this process is that we’re not analyzing random sets of data. We’ll be configuring Intentional tracking

Intentional tracking is the process that adds value to your tracking by implementing valuable configurations to analyze the data in a simplified manner. 

Let’s open our demo shop to understand the process. We already have tracking installed on the website. 

However, we haven’t installed GTM tracking on the website. Rather, we have hard-coded the tracking into the Page Source. 

No doubt, you can use the various source codes on your website wall to analyze your tracking data. 

But we recommend a simpler way. You can use Chrome extension tools like Google Tag Assistant Legacy. 

This extension shows you various tracking processes that are implemented on your website simultaneously. 

For example, on our website, we have three different tracking processes that are active. 

The Global site tag code is running in the background. It mentions the AW code below the name. This suggests that this activity is performed by Google AdWords currently. 

Next, we also have a Global site tag for G, which is running for Google Analytics. 

Also, we have a Google Ads Conversion Tracking process running in the background. 

Analyzing the fired Tags from the Google Tag Assistant legacy extension on the browser

Google Tag Assistant Legacy, however, only shows Google Tags on your website. 

You can also use other plugins like Facebook Pixel Helper, that show you the data on your Facebook Pixel account. 

Using Facebook Pixel Helper extension to track fired Tags and events on the website

If you want general information about all other integrations, you can also use the ObservePoint Tag Debugger plugin. 

This plugin allows you to access information from the More Tools → Developer Tools section of your website. 

Using developer tools from the more tools section of the browser

Click on ObservePoint and reload the page. 

Utilizing ObservePoint tool from the developer tools section of the browser

This will show us all the tracking processes from the various tools we configured on our website.

Analyzing ObservePoint tool from the developer tools section of the browser

If you want an even more extensive analysis of the codes and the sources of those Tags, we recommend you install WASP Extension Web Analytics Profiler

It helps you recognize the sources of various scripts. These may not be marketing scripts but are helpful for debugging. 

Utilizing WASP tool from the developer tools section of the browser

You can explore various extensions depending on your requirements. Some of these are the Twitter Pixel Helper Extension and the UET Tag Helper Extension

It is always a good idea to converse with various people related to the tracking field like the IT department, marketeers, or even various agencies. 

This can give you a clear understanding of what Tags are already installed on your website scripts and what codes you can further implement to make the tracking easier. 

We have created a sheet to formulate the Tag plan for our demo shop account. You can download a copy of this sheet and change the formatting of the sheet to meet your business needs. 

You can use it to document information like the date of the creation or implementation of a Tag.

Let’s add the date for a sample Tag we will create today. Our Date will be the date 15/02/2021 as we created the Tag on that day. You can add the date when you wish to create the Tag. 

Next, we’ll add the Tag Type. In our case, our Tag Type was Event Tag. As we used it for Google Analytics 4, we’ll keep the Tool as GA4

Add the Name you chose for your Tag. It is essential to have a naming convention for your Tags. This will help you in organizing them. The Name of our Tag is GA4 – Event – Button Click

For the Description/Purpose, we’ll add Tracks all Buttons on Pages. You can also add a note for the Tag. In our case, it will be Parameters: Click Text

Under Responsibility, you can add the name of the individual who is responsible for that Tag campaign. For our Tags, this name is Julian

Lastly, also mention whether there are any ToDo left for the Tag. In our Tag, this will be migrate to GTM

Understanding the sample plan for Tag implementation

Although it does seem cumbersome at first, making an organized Tag plan helps a lot in the long run. 

This process is especially useful if you are implementing a major Tag migration. 

It helps you to keep track of the Tags that are migrated and the Tags that need to be removed from the website once it’s already inside GTM.

We have an example where we’ve inputted several Tag entries which we wish to install on our GTM account.

This gives us a good idea about the configurations for each Tag. 

We don’t need to open our Facebook Pixel account for Pixel ID or our Google Analytics account for the Google Analytics Tracking ID. 

Understanding the sample plan for Tag implementation

This can be especially useful for presentations to your clients or explaining your tracking systems to your colleagues or employees. 

Make a copy of your Tags and plan the implementation of your marketing strategy on the sheet. 

Once your planning is complete, we’ll deploy our first Tag in a step-by-step process to put this plan into action.

How to Track Pageviews in Google Analytics 4 with GTM

Let’s open our Google Tag Manager account. We already have a version published with this account. But we haven’t yet implemented any Tags inside this container. 

We have already created a plan for configuring a GA4 PageView Tag to the account. 

The Tag deploys GA4 base tracking. We also have the tracking ID as the notes for configuration. 

Understanding the sample plan for Tag implementation

Let’s see how we got the tracking ID. 

Reopen the Page Source code. We can see the gtag code configured to our page. The code also mentions the configuration ID for our account. 

Analyzing website source code from the view page source section

We’ll use this ID to migrate our GA4 Tag to the GTM interface. In case you don’t have a Google Analytics 4 account, you can create it by signing in to the Google Analytics website. 

Further, you can also find your Tag installation ID by navigating to Admin → Setup Assistant → Tag installation

Navigating to Tag installation from the admin section of the Google Analytics account

Copy your Measurement ID. We’ll use this ID to migrate our codes. 

Accessing the measurement ID from the Google Analytics account

Once we have all the prerequisites, we’ll set up the Tag. 

Open your GTM account, and click on Add a new tag

Adding a new Tag from the GTM account

Add a name to your Tag. It is a good practice to use your own customized naming convention for that purpose. 

Click on Tag Configuration to add the Tag type. You’ll see various templates for creating a Tag here. 

Choose Google Analytics: GA4 Configuration

Configuring a new Google Analytics: GA4 Configuration Tag to the GTM account

This is simply a form in which you can fill in various fields to generate your Tags. 

Under the Measurement ID, paste the ID we copied from the GA account.

We also want to send a PageView event with this Tag. So, we’ll click on that option as well.

Configuring a new Google Analytics: GA4 Configuration Tag to the GTM account

Next, we’ll configure the trigger.

Triggers are the conditions under which we deploy the Tag. 

As we don’t have any special requirements, we can choose All Pages as our trigger type. Click on Save once done. 

Configuring a new Google Analytics: GA4 Configuration Tag to the GTM account

Let’s verify our implementation by entering the Preview mode. 

Entering the preview mode to verify changes to our fired Tags

If your preview mode is successful, you’ll see a message window on your website about Debugger connected.

Entering the debugger mode to verify changes to the fired Tags

If you verify the data on your preview tab, you’ll see that the Tag for GA4 – Preview – Configuration – All Pages is fired successfully.

Analyzing the fired Tags from the Google Tag Assistant legacy extension of the browser

We can also verify the same through the DebugView section on the Google Analytics website. 

Currently, our page_view is deployed on our page. 

Analyzing the fired Tags and events from the debugview section of the Google Analytics account

Let’s add another click event on our page to verify the results. You can simply reload the website. This will create another page view event for our tracking tools. 

It may take several moments for the data to load. 

When the results load, you’ll be able to see that two page-view events are tracked by our tracking tools. 

Analyzing the fired Tags and events from the debugview section of the Google Analytics account

The reason for the two PageView events is that we have two different tracking scripts installed for tracking. 

First, we have a tracking code installed in the View Page Source section. Additionally, we also have a Google Tag Manager code running on our page script. 

Accessing the code snippets from the website page source script

As we are manually tracking this event and also using GTM as our tracking tool for the same event, we are able to see two different entries for the same event. 

However, as we know that our GA code is deployed through GTM, we can actually remove that script from our page’s source code. 

Accessing the code snippets from the website page source script

Let’s now Submit our version for this Tag. It will go live on our website for all our users now. 

Submitting a current version of the website to make it live for the users

Add a Name to the version and click on Publish to make the version live.

Publishing a current version of the website to make it live for the users

We’ll now also remove the secondary tracking code from our page source.

Open the theme files for your website. Find your Global Site Tag code, and delete the entire code. Update the file once done.

Updating the changes to the source code script of the website

Reload the website and close the Google Tag Assistant tab. 

Finally, we can see that Google Tag Manager is deployed on our website, and Global Site Tag through Google Tag Manager is deployed on the page. 

Accessing the configured codes to the website from the Google Tag Assistant legacy extension

You can verify this once again by navigating to the Page Source code. 

If the codes are correctly removed, you’ll be able to see that we only have Google Tag Manager installed on our script. 

The Global Site Tag is deployed through GTM. 

Accessing the website source code to verify the GTM snippet

Going forward, you won’t be able to use DebugView to track user movements. This is because it is only able to track activity for the Preview mode. 

Hence, we can use Real-time reports to analyze user behavior and various tracking events. 

Analyzing the fired tags and events from the Real-time section of the Google Analytics account

However, if you develop codes from scratch, you won’t need to remove any access codes as there won’t be any duplicates. 

This process is only needed when you are migrating your Tags to Google Tag Manager. 

🚨 Note: Google Tag Manager can be integrated with various platforms, learn more about Google Sheets tracking with GTM and Active Campaign tracking with GTM.

How to Track Conversions in the Facebook Pixel with GTM

We already have a GA4 Tag installed on our website. Now, we also want to install the Facebook Pixel Tags with GTM. 

Both of our Tags will be Fb Pixel Tags. The first one is a Pageview – All Pages Tag, and the second one is a Form – Confirm Page Tag. 

The Form Tag is a conversion Tag that tracks whenever a user fills a form and sends over a Lead Event as the result. 

Let’s add these Tags to our customized Tag plan. 

Understanding the sample plan for Tag implementation

We also have the configurations from our Pixel accounts. You can find them in the Overview section on your Facebook Business Manager account. 

Accessing pixel ID from the overview section of the Facebook Pixel Manager

You can also find the configurations from the Settings section of your Pixel account.

Accessing pixel ID from the settings of the Facebook Pixel Manager

Let’s copy the configuration code so we can implement the planned Tag. 

Let’s create a New Tag from Tags

Creating a new Tag from the GTM account

We need a Tag for the Facebook Pixel configuration. Unfortunately, Facebook Pixel isn’t available as one of the templates in the standard templates by Google Tag Manager. 

So, we’ll open Community Template Gallery to access the Tag templates by different users. 

Choosing a Tag template from the template library of the GTM account

Search for the relevant Tag and choose the Facebook Pixel Tag configuration.

Choosing a Facebook Pixel Tag template from the template library of the GTM account

Go to Add to workspace → Add to confirm the use of the template configuration for our Tag. 

Adding a new Tag template to our Tags section on GTM

The Tag template will now be available in our Tag as its configuration. 

Paste the Facebook Pixel ID that we copied from the Facebook Pixel account. 

Configuring a new Facebook Pixel type Tag to the GTM account

We will keep all the other settings unchanged for this Tag template. 

We still need to add a trigger for this Tag. As our Tag is for all our pages, we’ll use the All Pages trigger for this Tag. 

Give an appropriate Name to the Tag, and click on Save

Configuring a new Facebook Pixel type Tag with all pages trigger to the GTM account

Open the Preview mode to verify the Tag configuration.

Entering the preview mode of the website to monitor changes to the fired Tags

Let’s reload our website to monitor the changes. As the Tag is configured on all pages, we can track it simply by reloading our page. 

If the configuration is correct, you’ll see the Fb – Pageview – All Pages Tag live on your website from your Google Tag Assistant account.

Analyzing the fired Tags from the Tags section of the Google Tag Assistant legacy extension

In addition, you can also verify the fired Tags from the Facebook Pixel Helper extension on your browser. 

Our Pageview event has already been sent over. 

Analyzing the fired events from the Facebook Pixel extension of the browser

You can also verify the event details from your Facebook Business account.

Navigate to Test Events and add the website URL. Once done, click on Open Website.

Entering the preview mode of the website from the test events section of the Facebook Business Manager account

This action will open your website on another tab. You can reload the website once again to generate a Pageview event. 

If the configuration is successful, you’ll see a PageView event added in the Test Events section of your Facebook Business Manager account. 

You’ll also get details about your event in this section. The data about the URL, Action Source, and Advanced Matching Parameters are all tracked in our case. 

Analyzing the fired events from the test events section of the Facebook Business Manager account

So that’s how we added a Facebook Pixel PageView Tag. We’ll also add the second Tag so that we can go ahead and Publish both Tags in a new version.

Our second Tag is a Fb – Form – Confirm Page Tag. 

Understanding the Tag plan for implementing the Tags

A form is just one of the many actions that you can track. 

It is important to analyze the audience requirements on your website. This will give you an idea about the events you can optimize to generate more traffic on your website. 

You can also monitor this traffic by making your users perform a certain action. Creating a form and tracking its confirm page action is one way to do it. 

🚨 Note: Check out our detailed guide to form field tracking with Google Tag Manager.

If you have an eCommerce website, you can also track the purchases of users and analyze data accordingly. 

Let’s now understand how Fb – Form – Confirm Page Tag works. 

We have prepared a sample form on our demo website. Let’s fill out the form to see how the Tag works. 

Filling out a sample form on the website to generate data for tracking

Once the form is filled, we’ll be redirected towards the confirmation page.

Entering the confirmation page for filling out a form on the website

We’ll learn to track user movement by using this confirmation page. 

Facebook provides a large number of pre-coded tracking scripts on its developer website. You can navigate the one that meets your business requirements. 

In our case, the best match for our requirements is the Lead event. This resonates with the standard form that we’re filling on our website.

Checking the best match for our Tags from the template gallery

To send over such a standard event, we first need to create a trigger that will only activate on the confirmation page on our website. 

Once we’ve received a confirmation for the completed form, we will open Container Loaded → Variables to verify the tracked data. 

Verifying the fired variables from the loaded container of the Tag Assistant account

Variables are placeholders that GTM uses to evaluate whether it should fire the Tags. 

For example, if our Page Path is /ninjaforms/confirm/, then we’ll fire the Tags. Let’s also copy the path URL. 

Verifying the fired variables from the loaded container of the Tag Assistant account

However, if we compare this data with other page views, the page will change based on the page we compared. 

Hence, we’ll set our trigger to fire on the variable that follows our chosen path. 

Navigate Triggers → New from your GTM account. 

Creating a new trigger from the GTM account

This won’t be an All Pages trigger anymore like the ones we previously used. This trigger will only fire on the /ninjaforms/confirm/ path. 

Add a Name to the trigger. 

We’ll choose Page View as our trigger type. Let’s configure the trigger to fire on Some Page Views only. 

As we want our trigger to fire only on a particular page path, let’s add the event conditions as Path Path equals /ninjaforms/confirm/

Save the Trigger once you’re done. 

Configuring a new page view trigger from the GTM account

This trigger will now fire only our /ninjaforms/confirm/ page. 

Let’s configure this trigger to a Tag. 

Create a new Facebook Pixel type Tag. Add your Facebook Pixel ID. 

Configuring a Facebook Pixel type configuration of a new Tag in GTM

Choose the Standard Event Name as Lead

Configuring a Facebook Pixel type configuration of a new Tag in GTM

Attach the pv- /ninjaforms/confirm/ trigger that we just created for this Tag. 

Add a Name to the Tag, and click on Save

Configuring a Facebook Pixel type configuration of a new Tag in GTM

Let’s verify the configuration by entering the Preview mode. 

Entering the preview mode of the website to verify changes to the fired Tags

Open the link to the form page from the preview section of your browser. 

Fill out the form to generate data for verification, but don’t submit the data just yet. We’ll see what information the fired Tag generates. 

Open the fired Tags data from Container Loaded → Fb – Lead – Confirm Form Tag.

Verifying the fired variables from the loaded container of the Tag Assistant account

The data shows that our Tag is Not Fired due to the wrong Page Path. 

Verifying the fired trigger from the loaded container of the Tag Assistant account

This is because we didn’t actually submit the form to generate the data on our confirmation page. We created our Tag to fire only on the pages containing /ninjaforms/confirm/. 

Remember that the confirmation page is the key to generating our results on the Tags. Let’s submit the form and enter the confirmation page. 

If the configuration is successful, you’ll see the Tag fired under Container Loaded → Fb – Lead – Confirm Form.

Verifying the fired Tags from the loaded container of the Tag Assistant account

Inside the Tag data, you’ll see that our Tag has Fired, and the criteria of the Firing Triggers match our data, 

Verifying the fired triggers from the loaded container of the Tag Assistant account

Verify the same details from the Facebook Pixel Helper extension as well. The data for our Lead event is now available. 

Verifying the fired Tags from the Facebook Pixel extension of the browser

Similar information can be tracked from the Facebook Business Manager account. Navigate to Test Events → Lead

Verifying the fired Tags from the Test Events section of the Facebook Pixel account

You can extensively use this data to optimize your campaigns successfully.

Publish your version to make these changes live for the audience. Click on Submit.

Submitting a current version of the website to make it live for the users

Add a Version Name and click on Publish to save the changes and make them live for all our users. 

🚨 Note: You can build higher quality audiences in your Facebook Ads by delaying your Facebook Pixel and eliminating bounced users from your audience.

Currently. We already have our GA4 Pageview Tag, a Fb Pageview Tag that fires on all pages, and one Fb Lead event that fires on confirmation pages. 

But, how do we track the user’s movements when they click some buttons like Add to Cart on our website? 

This information can help us tremendously in tracking and optimizing our campaigns. 

How to Track Button Clicks with GTM Auto-Events

We have added a new entry to our Tag plan, which includes a GA4 Tag that can track whenever a user clicks on the Add to Cart button. 

Understanding the sample plan for Tag implementation

We’ll use the benefits of Auto-Event triggers

Auto-Event triggers are the special triggers within Google Tag Manager that enable us to monitor the data of various user interactions on the website. 

Such triggers can be found from the trigger types template while creating a new trigger. 

They can provide various tracking like All Elements, User Engagements like Element Visibility, Form Submission, Scroll Depths YouTube Video, etc. 

There are various methods of performing each of these event trackings.

For example, instead of using the Form Submission trigger, we have created a Confirmation page on our website after the form. 

We can effectively track the user’s movements even without the trigger. However, it’s still important to learn to utilize event triggers. 

Under the Click triggers, we have the All Elements trigger, which helps in tracking clicks on all elements, and the Just Links trigger which helps in tracking clicks on various links.

Choosing the correct click triggers from the template library of GTM

In our case, we’ll go ahead with the All Elements type trigger. You can use them for all different combinations of click triggers.

As we want to create a generic click trigger, we’ll keep the trigger to fire at All Clicks.

Add a Name to the trigger, and click on Save.

Configuring a new all elements click trigger from the GTM account

Before we save the version, let’s also modify the Variables accordingly. Navigate to Variables → Configure

Configuring a new variable from the GTM account

Enable all the Click variables to add this functionality to our click trigger.

Choosing all click element variables to access triggers in the GTM account

Open the Preview mode and reload the website page.

We have a product title on our page named Hoodie with Zipper. Let’s click on the product title to monitor the changes.

Clicking product title on the website to generate data for tracking

Open the Google Tag Assistant tab, and navigate to Click → Variables. You’ll see all the data regarding your latest click.

Verifying fired event data from the Google Tag Manager extension

As we clicked on the title Hoodie and Zipper, it is visible on our Click Text data.

Verifying fired event data from the Google Tag Manager extension

You can add several such clicks to verify the results on your Tag Assistant account. 

Our main point of interest here is the Add to cart button.

Generating clicks on the website to populate data for tracking

This data is visible on our Google Tag Assistant account under the Click number 17. 

Verifying fired event data from the Google Tag Manager extension

All we need to do is find a variable that is unique to our Add to cart button. If you analyze all the clicks correctly, you’ll notice that the Click text is a unique property. 

A single add_to_cart_button is within the click classes. Select the data point and Copy it. 

Copying the fired event data from the Google Tag Manager extension

Let’s use this data to modify our generic click trigger into a unique trigger that only fires on the Add to cart clicks.

We’ll choose our trigger to fire on Some Clicks. Define the path as Click Classes contains single_add_to_cart_button. We’ve simply pasted the copied value as a condition that triggers on Some Clicks

You can modify the name of the trigger, and click on Save

Configuring the all elements trigger to the GTM account

As we earlier mentioned, there are other methods to carry out this tracking. 

We can use a completely different approach and use the Click Text as our variable and use Add to cart text as our reference click source. 

However, for now, we’ll just go ahead with the Click Classes option. 

Let’s attach this trigger to a Tag now. Create a new Google Analytics: GA4 Event type Tag. 

As the configuration Tag, we can choose the GA4 – Pageview Tag we created in the beginning of this guide. 

We can also add an Event Name, let’s keep it click in this case. We can also enter Event Parameters. 

For example, if we have a Parameter called click_text, we can add its Value dynamically, and keep it as Click Text.

Configuring a GA4 type Tag to the GTM account

Add the add to cart trigger as well to this Tag. Give it Name and click on Save

Configuring a GA4 type Tag to the GTM account

Open the Preview mode to verify our configurations. Refresh the website and click on the Add to cart button

If the configuration is correct, we’ll see our Tag is fired in the Google Tag Assistant. 

Verifying fired Tags data from the Google Tag Manager extension

You can also analyze these Tags from the DebugView option in your Google Analytics account.

A lot of events are tracked in this section, but one of them is our click event. You can click on it to find out more event details. 

Analyzing the fired tags and events from the debugview section of the Google Analytics account

A list of all the various parameters that are sent over is available in the event details. Our click_text of Add to cart is also sent across the Tag. 

Verifying fired event data from the Google Analytics account

Let’s also verify that our event will be fired only on the Add to cart button clicks. You can click on multiple sections and areas of your website to generate higher results. 

If the configuration is successful, you won’t see any Tags fired for such clicks under any other Click events. 

Analyzing the fired Tags from the events in the Google Tag Assistant legacy tab of the browser

You can also verify whether the system is dynamic or not. Open a new product on your website and click on Add to cart. 

If the configuration is successful, you’ll see a fired Tag for GA4 – Event – Add to cart click

Analyzing the fired Tags from the events in the Google Tag Assistant legacy tab of the browser

All the Tags and triggers are inter-usable. This means you can use these triggers for any of your events. 

You can also use our click – add to cart trigger for a Fb – Event – Add to Cart Tag. 

Configuring an add to cart trigger to a Tag in the Google Tag Manager account

Verify these results by entering your Preview mode. You can also use your Facebook Business Manager account to track the data by entering Test Events → Open Website

Entering the preview mode of the website from the test events section of the Facebook Business Manager Account

Open an item from your website and click on Add to cart. If the configuration is successful, you’ll see the Fb – Event – Add to Cart Tag fired on your click. 

Verifying fired event data from the Google Tag Manager extension

In the Facebook Business Manager account, you’ll get an Add to Cart event processed on your account. 

Click on the event to access more data about the Tag. 

Verifying fired event data from the Facebook Business Manager account

We’re still one step away from implementation. You need to submit this as a version to make the changes live on your website. 

Submitting a current version of the website to make it live for the users

You can add a Name to this version, and click on Publish to make the changes live. 

Publishing a current version of the website to make it live for the users

How to Continue Learning

There are a lot of ways in which you can continue learning about Google Tag Manager. 

Note that as Google Tag Manager is a hands-on tool, it requires more time in practicing rather than developing book skills. 

Thus, we recommend you develop more experience in creating Tags and monitoring changes in the audience movements. 

The best way to develop such experiences is to perform live experiments on a website. 

My suggestion would be to create a demo website for practicing GTM even if you have access to a website so you can test new techniques out before implementing them on your website.

If you don’t have an audience base of your own, you can definitely ask your friends to help them out with tracking and analyzing data. 

Once you have access to a website, you can experiment with various tracking techniques to get an idea about the processes and their working.

For example, you can start by learning the use of various triggers in the GTM template section like the Element Visibility trigger. 

Utilizing an element visibility trigger from the Google Tag Manager account

We recommend that you take a look at all the catalogs available in the GTM library and learn to implement them step-by-step. 

Don’t worry if you get stuck while learning or implementing any new changes to your tracking systems. 

It’s perfectly normal for all new visitors to encounter obstructions while implementing your techniques.

We have created a GTM resource guide that can guide you with relevant resources regarding any implementation problems on your GTM account.

FAQ

How do I install Google Tag Manager on my website?

To install Google Tag Manager on your website:

1. Sign in to your Google Tag Manager account or create a new account.
2. Create an account and container in Google Tag Manager.
3. Obtain the GTM snippets from your account.
4. Add the GTM code snippets to the header and body sections of your website’s code. The specific method may vary depending on your website’s CMS or setup.
5. Verify the installation by checking the source code of your website.

How can I test and debug my tags in Google Tag Manager?

Google Tag Manager provides a preview mode that allows you to test and debug your tags before they go live on your website. By enabling preview mode, you can verify if the tags are firing correctly and track the data they capture. Additionally, you can use tools like Google Tag Assistant or the Test Events feature in Facebook Business Manager to further test and validate the tag implementation.

Can I roll back changes in Google Tag Manager?

Yes, Google Tag Manager allows you to roll back changes by accessing previous versions of your tracking setup. If you encounter issues or want to revert to a previous configuration, you can navigate to the version history in Google Tag Manager and restore a previous version.

Summary

So that’s all you need to know about Google Tag Manager. 

You’ll understand more about how Google Tag Manager works when you start working on real models and analyzing live audience trends.

Continue your learning journey by learning about popup tracking with Google Tag Manager.

What events does your website track? Which path did you use to set up your trackings? Let us know in the comments below!

Google Tag Manager Quiz

MeasureMasters

REOPENED!

Master Data & Analytics with MeasureMasters

Exclusive Courses & Workshops | Ongoing Troubleshooting | Support Resources, Tools & much more
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
MeasureSchool Locker

Unlock our Free Tools, Templates and Resources

now it's time to

Start measuring like a master

Itching to jump into the world of MeasureMasters? This is what you have to look forward to.

Ready to take your digital marketing to the next level?

Subscribe to our newsletter and stay ahead with our latest tips and strategies.