If tags are the tools that send data, and triggers decide when they fire, then variables are the data itself.
Variables in Google Tag Manager store information that your tags and triggers use to work correctly.
Without variables, GTM would not know what value to send, what page the user is on, or what button they clicked.
Simple Explanation
A variable is a container for information.
It can store things like:
- Page URL
- Click text
- Product price
- Order value
- Form ID
- User country
Whenever a tag fires, it can pull data from variables.
How Variables Work in GTM
Variables are evaluated every time something happens on the page.
For example:
- A page loads → GTM checks Page URL variable
- A button is clicked → GTM checks Click Text variable
- A purchase happens → GTM checks Order Value variable
Tags and triggers use these values to decide what to do.
Example: Tracking a Purchase Value
Your website pushes this to the data layer:
dataLayer.push({
event: "purchase",
value: 129
});
In GTM you create a Data Layer Variable named:
value
Your Google Ads conversion tag then uses that variable to send the revenue to Google Ads.
Without the variable, the tag would fire but send no value.
Types of Variables in Google Tag Manager
GTM has two main types of variables.
Built-in Variables
These are pre-made by GTM.
Examples:
- Page URL
- Click Classes
- Click ID
- Referrer
- Scroll Depth
You just enable them and use them.
User-Defined Variables
These are custom variables you create.
Common ones include:
- Data Layer Variables
- JavaScript Variables
- Constant Variables
- Lookup Tables
- Regex Tables
These let you pull or transform data exactly how you need.
Why Variables Signal Professional Tracking
Most broken tracking setups fail because of variables, not tags.
Common issues:
- Wrong data layer key name
- Variable returns undefined
- Value is formatted incorrectly
- Currency not passed
- Missing user data
When variables are correct, tracking becomes reliable and scalable.
Real-World Use Cases
Variables power almost every serious setup:
- Sending revenue to Google Ads
- Tracking product IDs
- Detecting logged-in users
- Passing email for enhanced conversions
- Identifying traffic sources
- Mapping form submissions
If GTM is the engine, variables are the fuel.
Key Takeaway
Variables in Google Tag Manager store the information that tags send and triggers use.
They are the foundation of accurate measurement.
When variables are configured correctly, your data becomes trustworthy, your automation improves, and your campaigns perform better.
Next in the GTM Intro Series:
What Is the Data Layer in Google Tag Manager?
Related Posts
What Is a Tag in Google Tag Manager? A Beginner-Friendly Explanation
6 min read
What Is the Data Layer in Google Tag Manager? The Foundation of Accurate Tracking
7 min read
What Is a Trigger in Google Tag Manager?
6 min read
Need Help With Your Google Ads?
I help e-commerce brands scale profitably with data-driven PPC strategies.
Get In Touch