In tag management, a variable is a named placeholder for a value, such as the page address, the text of a clicked button or the total of an order, which the tag manager works out at the moment it is needed. Instead of typing a fixed value into each tag, you refer to the variable and the current value is filled in.
How variables work
A tag management system such as Google Tag Manager is built from three parts. Tags send data somewhere, triggers decide when, and variables supply the details. Variables are used in two places:
- In trigger conditions. A trigger might fire only when the variable Page Path contains /thank-you/, or when Click Text equals “Book a call”.
- In tag fields. A purchase tag might send the variable holding the order value as the conversion value, and the variable holding the order reference as the transaction ID.
Each time something happens on the page, such as a load, a click or a form submission, the tag manager works out the variables afresh for that event. That means the same variable can return different values at different moments. A variable reading the basket total returns nothing on the home page and £86.40 at checkout.
Variables come in two families. Built-in variables are standard values most sites need, switched on with a tick box. User-defined variables are ones you configure for your own site, most often by reading values from the data layer.
Why it matters
Variables are what turn a basic “someone converted” signal into useful data. Without them, a Google Ads conversion has no value, a GA4 event has no detail and every tag carries hard-coded settings that someone has to remember to update. With them, one change to a variable updates every tag that uses it.
They also decide how accurate your triggers are. A trigger that relies on the wrong variable, or one that reads a value which changes after a site update, can fire on every page or on none. A common tracking failure on small business sites is a single variable that quietly stopped returning what everyone assumed it did.
In the UK, variables carry a privacy responsibility too. A variable can read anything on the page, including what a visitor typed into a form. Passing that into an advertising tag without consent, or without telling people in your privacy notice, creates a PECR and UK GDPR problem.
Common mistakes
- Hard-coding IDs and values in dozens of tags instead of storing them once in a variable.
- Building triggers on variables that depend on page wording or layout, which break when the site changes.
- Assuming a variable holds a value on every event when it only exists on one.
- Leaving unused variables in the container, which makes audits slower and mistakes more likely.
- Reading form fields into variables and sending them to third parties.
How to act on it
Open your tag manager and list the variables your conversion tags depend on. For each one, ask where its value comes from and what would break it. Anything critical, such as revenue, order ID or lead type, should come from the data layer rather than from page text.
Use preview mode to watch variables change as you click through a real journey, from landing page to thank-you page. Then tidy the container: consistent names, no duplicates, nothing unused, and a note against any variable that depends on page wording so it is checked after every redesign.
If your conversion data looks thin or inconsistent across platforms, a tracking review is usually the right first step, and it is part of how I start any performance marketing engagement.
