How to add a Constant in Google Tag Manager

One common challenge in efficient management in tag manager is the repetitive entry of identical information, such as a Measurement ID in Google Analytics 4 tags. To address this, introducing a constant variable in GTM can save time and reduce errors. This guide provides a practical approach to setting up a constant variable, its advantages, and its application.

What is a Constant and its benefits

A constant in GTM is a type of variable that retains a fixed value once set. This functionality is especially useful when the same value is used across multiple tags. By using a constant, you can:

  • Minimize Errors: Reduces the risk of typos from entering data multiple times.
  • Ease of Updates: Change the value in one place, and all associated tags will automatically update.
  • Time Efficiency: Saves significant time and effort when setting up or modifying tags.

Example: Creating a Constant

To create a constant in GTM, follow these steps:

Navigate to Variables: In your GTM dashboard, go to the "Variables" section and select "New."

Configure the Variable: Choose "Variable Configuration," then select "Constant." Here, input the value you need to reuse, such as your Measurement ID.

Name and Save: Assign a descriptive name to your constant and save the configuration.

Using the Constant in Tags

With the constant set up, you can now use it across various GA4 tags or any other tags that require this value:

Insert the Variable: When creating or editing a tag, click the “Insert Variable” button next to the input field where the constant is needed.

Select the Constant: Type {{ to initiate the variable selection dropdown, then choose your constant from the list.

By integrating the constant, the need for manual entry is eliminated, thus streamlining the tag management process.

Wrapping Up

Employing a constant variable in GTM not only enhances the accuracy and efficiency of your tag management but also simplifies future modifications. Should you encounter issues not covered here or discover additional insights, please reach out through our support ticket system.