Tracking Pixels with Google Tag Manager

Reading Time: 3 minutes


Hi Everyone! This is my first blog and in this, I’ll try to explain how we can use Google Tag Manager to manage and deploy tracking pixels (eg. Google Analytics) on your website without having to modify the code

Tracking Pixels

A tracking pixel is an HTML code snippet that is loaded when a user visits a website. It is useful for tracking user behavior and conversions.

Google Tag manager

Google Tag Manager is a tag management system (TMS) that allows you to quickly and easily update tracking codes and related code fragments collectively known as tags on your website or mobile app. Once the small segment of the Tag Manager code has been added to your project, you can safely and easily deploy analytics and measurement tag configurations from a web-based user interface.

Tags (eg. Google Analytics, Facebook Pixel)

Tags are segments of code provided by analytics, marketing, and support vendors to help you integrate their products into your websites or mobile apps. With Google Tag Manager, you no longer need to add these tags directly to your projects. Instead, you configure and publish tags and how they fire from within the Tag Manager user interface.


In Google Tag Manager, tags fire based on events, such as when a form is submitted or when a video is played. Triggers are used to listen for these events, and they govern when a tag is fired or blocked. You can further specify when a trigger fires with trigger filters

Trigger Types available in Google Tag Manager

I have linked the following to support page of google, from where we can get the detailed information about these.


Demo 1 (Using Google Analytics)

In Google tag manager we have made an event that will fire when the user scrolls to 25%, 50%, 57%, and 100%.

Google Analytics Demo

We have added this google tag manager code snippet to our website and switch on the preview of google tag manager to check when the tag gets activated.

Google Analytics Demo 3

As we have made google analytics tag to get fire on the scroll. So, data will be tracked in the Google Analytics dashboard.

Google Analytics Demo 2

Demo 2 (Using Facebook Pixel)

Similarly, we have used Facebook pixel-like we have used google analytics. Facebook pixels can also be used to track user behavior on our website and data gets stored in the Facebook analytics dashboard. 

For this, we have created a custom tag in google tag manager where we have added a tracking code snippet provided by Facebook pixel and created a trigger that fires the tag when we open the page i.e. on page view.
We can check in the preview that when we load the page-tag gets fired. 

Facebook Pixel Demo

We can check those analytics in Facebook analytics dashboard.

Facebook pixels demo 2


We can use google tag manager to fetch users’ data visiting our website and provide it in google analytics. Google tag manager provides us different triggers to track events by the user. Eg. There is an event that tracks the scroll depth, where we can trace the depth the user has scrolled to on our website.


Written by 

Bobin Singla is a UI consultant having more than 2 years and 6 months of experience. Bobin likes to develop websites. He loves playing football and digital games, moreover, he has also won the FIFA tournament. Bobin is familiar with programming languages such as Angular 2+, Javascript, HTML and CSS.