Tags, Triggers, and Variables
What you'll learn: How Google Tag Manager's three core building blocks work together to control when and how third-party scripts execute.
Understanding the Three Pillars
Google Tag Manager organizes everything around three fundamental concepts that work in harmony:
Tags: What Executes
Tags are the actual pieces of code that run—think analytics snippets, conversion pixels, or chat widgets. Instead of hardcoding these scripts into your HTML, you define them as tags within GTM. Each tag is essentially a wrapper around the third-party code you want to execute.
Triggers: When It Executes
Triggers define the conditions that must be met before a tag fires. They answer "when?" questions:
- When the page loads?
- When someone clicks a specific button?
- When a form is submitted?
- When the user scrolls 75% down the page?
Without triggers, tags would never run. You attach one or more triggers to each tag to control its execution timing.
Variables: Dynamic Values
Variables are placeholders for values that change. They might capture:
- The current page URL
- Which button was clicked
- A product ID from the page
- Custom data from your application
Variables feed data into both tags (to send the right information) and triggers (to make decisions about when to fire).
How They Work Together
Think of it like a smart home system: Variables are the sensors (detecting temperature, motion, light), Triggers are the conditions ("when motion detected AND after 6pm"), and Tags are the actions (turn on lights, send notification).
A typical example: A tag (Google Analytics event) fires based on a trigger (button click on .checkout-button) and sends variable data (product name, price) to your analytics platform.
Key Takeaway: GTM's tags define what runs, triggers define when it runs, and variables provide dynamic data to both—giving you complete control over third-party integrations without touching your source code.