Google Tag Manager makes tracking useful.
May 15, 2025
Basics - Google Tag Manager allows every website owner to easily track almost everything that happens inside the webpage. Google Tag Manager does that by adding lines of codes into the website. So, you can track all events a typical visitor performs once landing in your site. Things like how far down the page the user went, or which button is clicked. But because we can track everything, doesn't mean we should. To keep things simple and effective we need to link every event with an objective. After doing it we can analyze the aggregate data in Google Analytics and potentially make better decisions.
Google Tag Manager Ingredients: Tags, Variables, Triggers and Data Layer
• Tag: Think of it as a piece of code that you put on your site for tracking purposes. The purpose of tags is to tell Google Tag Manager what to do - such as record if someone view our website and send a pageview hit to Google Analytics.
• Trigger: When, where, how you want your tag to fire? You need to specify that. If you want to fire a tag to record the numbers of successful subscribers for your newsletter, you need to specify the conditions. You want the tag to fire when someone just scrolls the page or when one actually clicks the "subscribe" button? As Google says conditions can be clicks, form submissions, or page loads.
• Variable: For me, the most difficult one to start getting used to but certainly the most powerful ingredient in the plate. Basically, variables are values found in your website that can be used in triggers and/or tags. In triggers, a variable is always required. They can be used to further specify the trigger condition (e.g.: fire a trigger when URL variable contains: example.com/thankyou). In tags, they are used to capture dynamic values such as product value ($99).
• Data Layer: Data Layer is a transmitter. Metaphorically, is a container that stores structured information pulled out from the website and pass it into Google Tag Manager, specifically to fill variables and activate triggers/tags. For my travel blog I used a WordPress plugin to create the data layer.
Business Perspective - Okey, okey but so what? Why should I care? Yes, this is a fair question. The tool is just a tool if we don’t find clever ways to make is useful. The question remains: what metrics make business sense to track? How can it generate more revenue for me? How to understand customer expectations’ and hopefully their behavior? I will list the most common events businesses in hospitality industry would want to track. But these principles are not limited to the hospitality sector.
Technical Perspective - Now let’s understand how to actually do it?
Before starting we must make sure the website has a data layer.
1. Track Scroll Depth: So, how to track users and understand how far they scroll down a page? First thing to do, create variables that will be used in the triggers and variables. We are lucky as Google Tag Manager has already build variables we want to track. To enable them you need to follow this particular path. Variable > Built-In Variables > Enable Scroll Depth Threshold
Then, it’s time to create the trigger. When do you want the trigger to fire? Apparently we want it to fire when we scroll down the page. To create this trigger you follow this path. Trigger > New > Under User Engagement click Scroll Depth. You need to customize the trigger a bit by choosing the level of depth user must reach to fire the trigger. E.g. 50% of the page.
In the end we set up the tag. We choose the event name: scroll. We then add the event parameter. These date will be shown in Google Analytics. In this case, parameter name: percent_scrolled and value (variable): {{Scroll Depth Threshold}}.
This blog will be updates continuously with new tracking ideas.