A Guide to Google Tag Manager Variables

Google Tag Manager Variables

This is an intermediate article on Google Tag Manager. If you’re new to GTM, we recommend you read our two previous posts on the topic.

  1. How to Install Google Tag Manager
  2. Google Tag Manager Tutorial for Beginners

Introduction to Google Tag Manager Variables

If you have ever wondered how to track dynamic conversion values to accurately measure your campaigns results, variables are your answer.

Google Tag Manager variables are one of the most important components in this tool and, armed with the proper knowledge of how they work, will take your reporting to a whole different level.

Whether you need to pull dynamic conversion values, or track very specific user actions such as button clicks, form fills, or other types of events, you will learn the basics on how to do so in this post.

Let’s get to it.

What Are Google Tag Manager Variables?

Variables are “(…) named placeholders for values that are populated when code is run on your website or mobile app.”, according to Google.

In other words, variables hold values for different elements on your website.

For example, the “Page URL” variable on this page contains the value “theconversionlift.com/tag-manager-tags-variables”.


How to Create Variables in Google Tag Manager

There are two different types of variables you can use in Googe Tag Manager.

  • Buit-In Variables: these are pre-created by Google, and non-customizable. You can use them in a wide array of different scenarios.
  • User-Defined Variables: custom user-defined variables that can be used to cover specific requirements not already covered by built-in variables.

Built-In Variables

Before you can use built-in variables, you’ll need to enable them first.

To do so, access the variables pannel in Google Tag Manager by clicking on the “Variables” button in the left sidebar panel.


Click on the “configure” button in the top-right and check the tick-boxes for the variables you wish to enable.


Once you enable these variables, they will become visible when you enable Google Tag Manager’s preview mode – and you can use them in your tags, and triggers.

We’ll cover more of the preview tool in a minute.

User-Defined Variables

In some cases, you’ll need variables that aren’t covered by the default pre-selection that comes with Google Tag Manager.

To create user-defined variables, scroll down to the bottom of the page and, in the user-defined variables section, click on the “new” button.


There are lots of different user-defined variable types you can choose from, and an almost endless amount of variables you can create.

We won’t cover the different variables in this post, but we’ll show you some examples in a few minutes.

In case you’re curious, here’s a list of the variable types you can create.

How To Identify Variables On Your Website

To make all this easier to understand, let’s take a look at Google Tag Manager’s preview tool. To enable the preview mode, click on the “Preview” button on the top of your dashboard.


Once enabled, open your website on a different browser. You should see the preview mode panel in the bottom of your screen.


After clicking one of the events on the summary column to the left, and then on the variables button on the header of the panel, you will see a list with all the available variables, and their respective values.

For example, in the image above, the variable “Page Path” contains the value “/analytics-tools/google-tag-manager-tutorial”.

You can use these variables and their respective values to trigger tags, pull values into tags, or even create new variables.

How To Use Google Tag Manager Variables

As we discussed, variables can be used in both triggers, and tags. They serve different purposes, but are fundamental in both cases.

  • In Tags: used to capture dynamic values;
  • In Triggers: used to define filters that specify when a particular tag should fire.

Let’s look at an example to make that easier to understand.

Variables In Tags

Let’s assume you own an eCommerce store that sells men’s clothing for customers in Europe.

In an effort to increase sales on your store, you’ve launched a Google Ads campaign and want to add different Google Ads conversion tags to measure how many users add products to cart, checkout, and purchase, and the respective values for each event.

To do that, you would have to follow a few easy steps.

  1. Use the preview mode to identify the variable that contains the product’s price.
  1. Create a Google Ads conversion tag that fires whenever a user adds a product to the cart.
  1. Add the “dlv – price” tag in the “value” field, in curly brackets, to pull the variable’s value into the tag.

Before you can save and publish the tag, you’ll need to add a trigger that fires whenever someone adds a product to the cart.

You can do this in a few simple steps.

Variables In Triggers

As we mentioned, variables can also be used to define new trigger conditions.

In the case above, you’ll need to identify a variable that “tells you” whenever someone adds a product to cart.

Taking a look at the preview tool again, when we click the “Add to Cart” button, we can see that the built-in “Click Text” variable contains an “ADD TO CART” value.

We’ll use this to create our trigger.


When you create a click-based trigger, you’ll use the value above to define when it should fire.


In the preview mode in the image above, you can see an “addToCart” event under the summary column, to the left. We’ll explain how to push custom events with the data layer in another post.

You can then add the trigger to your tag, and hit the publish button.

What’s Next?

Google Tag Manager variables are essential to accurate reporting.

Now that you’ve learned how to use some of the more basic variables, it’s time you move on to a more advanced level of Google Tag Manager.

The next article in this series will cover the basics of the Data Layer – and will teach you how to pull almost any data element from your website, and turn them into variables you can use in your tags and triggers.

In fact, in this post, we have already created a data layer variable: the “dlv – price” variable. We used this variable to pull the price from the product added to the cart, and include it in our reports.

So how exactly can we do that?

Did you have any trouble setting up your first variables?

If so, let us know in the comments and let’s talk!

Make sure you subscribe to our newsletter to be the first to receive next week’s post, directly in your inbox.

Leave a Reply

Your email address will not be published. Required fields are marked *

I accept the Terms and Conditions and the Privacy Policy

You May Also Like