What's new

Welcome to Digital Marketing Forum - Marketingforum.info

Welcome to our digital marketing forum! Join our community now and unlock a world of opportunities. By registering and logging in, you'll gain full access to a plethora of features. Engage in lively discussions, share ideas, and connect with like-minded professionals.

Ask question

Ask Questions and Get Answers from Our Community


Answer Questions and Become an Expert on Your Topic

Contact Staff

Our Experts are Ready to Answer your Questions

Step-by-Step Guide: GTM Variable Creation

SEM Geek


Staff member
Jun 21, 2023
Reaction score
Google Tag Manager (GTM) offers a powerful way to manage and deploy various tracking codes and scripts on your website. One essential feature of GTM is the ability to create variables, which allow you to store and reuse dynamic data across different tags and triggers. Here's a step-by-step guide on how to create variables in GTM:

Step 1: Access Google Tag Manager

Log in to your Google Tag Manager account and navigate to the container where you want to create the variable. Containers contain all the tags, triggers, and variables specific to a particular website.

Step 2: Go to the Variables Menu

Once you're in the desired container, click on "Variables" in the left sidebar. This will take you to the section where you can manage and create variables.

Step 3: Choose Variable Type

Click on the "New" button to create a new variable. GTM offers various variable types, such as built-in variables, user-defined variables, and custom JavaScript variables. Select the appropriate variable type based on the data you want to capture or manipulate.

Step 4: Configure the Variable

Depending on the chosen variable type, you'll need to configure specific settings. For example:

If you're creating a variable based on a built-in template (e.g., Page URL), you might need to specify additional details like the component type or defining conditions.
If you're using a user-defined variable, you can manually set the variable values using static or dynamic data.
Ensure to follow the instructions and provide the required information accurately.

Step 5: Test and Preview

Before finalizing the variable, it's crucial to test and preview its functionality. This allows you to verify that the variable returns the expected results and can be used correctly when configuring tags and triggers.

Step 6: Save and Publish

Once you're satisfied with the variable's configuration, save the changes made in GTM. You can then proceed to publish your container to ensure the variable becomes active on your website.

Step 7: Use the Variable in Tags and Triggers

After creating and publishing the variable, you can start incorporating it into tags and triggers within GTM. Select the appropriate variable when configuring a tag or trigger that requires the dynamic data stored in the variable.


Creating variables in Google Tag Manager allows you to store and reuse dynamic data across tags and triggers, enabling you to enhance your tracking and deployment strategies. By following these step-by-step instructions, you can easily create variables in GTM and start leveraging the power of data-driven marketing for your website.