Scroll to top

How to Easily Install Tracking Pixels on Your Website With Google Tag Manager

Have you noticed a banner ad “following” you as you browse through the internet? A pint-sized banner, keeping an eye on you? If you have, you’re already aware of the power (or poor execution, depending on the quality and frequency of the advertisement).

These powerhouses are frequently misunderstood. Using them in the right way can have a tremendous impact on your business. From transforming your next campaign, optimizing your website, to even boosting your conversions – all of it is made possible by tracking pixels (that’s what they’re called!).

Using tracking pixels, companies can find out detailed insights into their visitors and their actions. Because of the same reasons, many digital marketers have embraced these tiny bombs, also known as tracking pixels. In a world of digital display advertising, tracking pixels help you know the number of people who’ve seen your ad, visited your website, opened the mail you sent them, and more.

We’ll not get into the details of how tracking pixels work, but we will tell you something even more important for your business.

It’s really a pickle of a situation when it comes to being able to track pixels on multiple social media and tracking tools on your website. To help you with that, let’s talk about the perfect solution – the Google Tag Manager!

What Is Google Tag Manager?

In the most simple words possible, Google Tag Manager is the one-stop solution for efficiently installing and managing multiple tracking pixels for different platforms

Google Tag Manager (GTM) is an advanced tag management tool that functions like a linking bridge (or a mediator of sorts, if you will) between a website/mobile application and third-party tracking tools. Let your imagination run wild for a minute and think of GTM as your toolkit that contains all the essential tools of your trade in one place, be it Google Analytics and Google Ads, or be it Facebook or Twitter pixels.

And how exactly does it simplify the entire process of tracking pixels?

To use GTM, you only need to add the tracking codes to the GTM and configure the rules as to when they should fire (launch) according to what suits you best.

Now, let’s travel back in time to before GTM existed. Although tracking pixels on a website has been a prevalent practice for a long time now, the difference between then and now is that the methods used back then were kinda primitive. That is, each time you wished to install a tracking tool on your website (say Google Analytics), you’d have to incorporate a specific portion of the tool’s JavaScript code on your website, so that when a user visits your website, the tracking code gets loaded to track the visitor.

While this may seem like an easy, one-time-think task that you can get done by a developer, don’t be fooled! To utilize a tracking tool like Google Analytics to its full potential, you need to track not one but a variety of metrics like clicks, interactions, sales, and so on, which means that you will need to add more tracking codes to your websites and also modify/upgrade the existing ones as you go. In such a situation, relying on a developer for each little change can not only cost you money but it will also cost you time.

This is where Google Tag Manager comes in to save the day! Apart from allowing you to manage and track multiple pixels from a centralized platform, GTM also allows you to change your tags without actually having to modify the source code of your website! So, you can go ahead and edit tags directly on the GTM interface and publish them.

As long as we’re talking about Google Tag Manager and Google Analytics, let’s get one thing straight – Google Tag Manager and Google Analytics are both entirely different. They are not the replacements of one another. Like we said before, GTM is a tag management solution whereas, Google Analytics is a tool that gathers valuable data and puts it in the form of concrete reports. How do they work together? GTM intercepts the interactions on your website and transfers that data to tracking tools like Google Analytics.

Check out- Top-Rated Inbound Marketing Agency

Google Tag Manager – Breaking It Further Down For You!

Before you get all hyped up about installing GTM, there are a few core concepts you should be aware of – tags, triggers, and variables.


Tags are a written code that fire on a website under specific circumstances to achieve a specific end. For instance, you could create and fire a tag to alter the color of your landing page. Creating a tag is like commanding the GTM to perform a particular task and hand over the relevant data to the third-party tracking tools.


Every tag you create needs a specific condition as to when it must fire. This condition is a trigger. So, you could condition a tag to trigger on specific clicks or on successful form submissions – you get the drift, right?


Variables are like connecting dots between tags and triggers. A variable can, for instance, contain a single piece of data (website domain, page URL, etc.), or it can contain multiple settings/host of data (Google Analytics comes with various settings such as tracking ID, display settings, etc.), or it can be a complex function.



How To Install Google Tag Manager?

Now, coming to the most awaited part of this blog post – How to install Google Tag Manager?

The first step in the installation process is to create a Google Tag Manager account. To create an account, visit the Google Tag Manager official page and click on ‘Start For Free’ option. This step becomes easy if you already have a Google account (I mean who doesn’t have a Google account?) so you can automatically log in to GTM with your Google account. If you don’t have a Google account, it’s high time you make one!



Create A New GTM Account

Once you’re logged in to GTM, you’ll need to create a separate GTM account along with a new container that can hold numerous tags, triggers, and variables. An added advantage here is that if your business has multiple websites with similar structure and tracking features, you can use one single container for all your websites.



After you’ve successfully created a container, GTM will provide you with two codes that need to be added to your website. You can find the codes either by clicking on the container ID link or by following this pattern: Admin > Account > Container > Install Google Tag Manager.



Now that you have got the codes, follow the instructions offered by GTM and carefully place the first code in the <head> tag of your website and add the second one immediately after the opening <body> tag. While the first code directs your page to load the GTM container asynchronously, the second code functions as a backup and allows you to track visitors without a JavaScript. Make sure to add these codes to all the pages of your website. The process becomes easier if you’re using a platform like WordPress that come equipped with GTM plugins to make the installation process hassle-free.

NOTE: Even if it’s not 100% important to add the script part of the code to the <head> tag, it’s better if you do since it facilitates enhanced tracking. The higher up you place the <script> snippet in a page, the faster it will load, thereby allowing you to track more visitors and monitor their activities. DO NOT add both the <script> and the <noscript> parts in the <head> because it will render your website’s HTML as invalid.

Create A Tag

With your GTM account and container in place, it’s time to create your very first tag (yaaay!). Usually, the first tracking tag that marketers install with GTM is Google Analytics.



To create a new tag, you have to go to the Tags option and click on New. You’ll see that two windows appear on the screen – one is for the configuring the tag and the other is for the trigger. Now click on the Tag Configuration and select the Google Analytics tag.



To create a new tag, you have to go to the Tags option and click on New. You’ll see that two windows appear on the screen – one is for the configuring the tag and the other is for the trigger. Now click on the Tag Configuration and select the Google Analytics tag.



Move on to Google Analytics Settings Variable drop-down menu and select New Variable to create your very first variable.



In the GA Settings Variable, you need to insert the tracking ID of your Google Analytics account so that GTM knows where to send the data.



You can obtain the tracking ID by following this path: Google Analytics account > Admin > Tracking Info (on a Property level) > Tracking Code. Now, copy the tracking ID and paste it in the Google Analytics Settings Variable.



After covering the tag part, it’s time to allocate the triggers correctly. Go to the Triggering section and click anywhere on the white block. Choose the All Pages trigger as the default option and set the Page View option for the Track Type. By doing so you are ensuring that the Google Analytics Page View tag will fire on all the pages where the GTM container code has been incorporated.



Finally, update your Google Analytics filters, save all the changes and voila, you’ve created your first tag!

This is basically how you can integrate your Google Analytics tracking pixel to the GTM to perform the following functions:

  • Track visitors on your website with GA (the Tag)
  • Fire the tag on all pages (the Trigger)
  • Transfer the data to your Google Analytics account (the Google Analytics tracking ID inserted in the GA Settings Variable serves as the Variable)

Test and Debug The Tag

Before you publish the tag to track visitors and other metrics, it’s crucial to check whether everything is in the right place. For this, you have the GTM Preview and Debug mode that allows you to browse through the site where you’ve integrated your GTM container code.

To get started with the preview mode, click on the Preview button in the top-right corner of the page.



Now, you’ve to go back to the page where the GTM container code is integrated. Refresh this page and you’ll find a debug console panel at the bottom of the page containing all the detailed information about the data being processed and which of your tags have been successfully fired and when. This console window is exclusive for the Preview mode so you need not worry about your visitors finding out about any possible error – nothing will show to the outside world unless you’ve published your changes).



In this way you can check out your Google Analytics Page View tag in the Preview and Debug mode. Click on the Page View option (located on the left side of the debug console) and check whether or not your  Google Analytics tag has fired successfully.

Make It Official – Publish The Container!

Once you’ve established that everything has been configured correctly and is free of errors, it’s time to publish your GTM container to make all the changes you’ve created so far official. Also, you cannot track your visitors if you do not publish the container. To publish your GTM container, click on the Submit option that’s placed right beside the Preview option.



While publishing the container, make sure that you fill out the boxes for the Version Name and Version Description. Although this is not mandatory, it will prove to be very useful in the long haul when there’ll be more than ten-twenty versions. Naming each version will allow you to see when what change was implemented in which version.

A great thing about GTM is that each time you publish a container with all the tags, triggers, and variables, a new version is automatically created. This can be of use if and when a new container crashes, you can go back to the older version.

The moment you press the Submit button, all the changes you’ve made to your Google Analytics tag will become live and you can now start tracking the visitors on your website.  

So, there you have it – the complete guide to installing Google Tag Manager and integrating your favorite tracking tools to track the various metrics that define digital marketing. What are you waiting for? Go and hit it off with Google Tag Manager already!

Author avatar
Shriya Garg
Shriya is the co-founder and CEO at ContentNinja. She started her first blog when she was 12 years old, and coded her first website by the time she was 14. An avid reader and writer, she published her first book when she was 16 years old and has sold over 10,000 copies since. When she's not fielding client calls, Shriya can be found cleaning cat hair from her clothes.