Stape

Type Convertor Variable for Google Tag Manager Server Container

Published
Jul 28, 2023

The Type Convertor Variable for Google Tag Manager (GTM) Server Container is designed to streamline the process of type conversion within the GTM environment. This utility is particularly useful when you have data in one type but need it in another type, such as converting a string into an integer.

For instance, there could be situations where you have a user event tagged with a string, but for further data processing, analysis, or integration with another system, you need that data in an integer format. This is where the Type Convertor Variable steps in, making this transition smooth and hassle-free.

The variable provides support for various type conversions including:

  • Integer
  • Number
  • String

The Type Convertor Variable ensures that the data is transformed into the desired format, paving the way for more accurate and effective data handling in the GTM server-side tagging environment.

How it works:Copy link to this section

When setting up your GTM Server Container, you will define your variables as you usually would. However, with the Type Convertor Variable installed, you now have the ability to choose the 'Type Convertor Variable' as the variable type and define the input type and output type of your data.

type convertor variable

1. Download Type Convertor Variable from GitHub. Import the variable to server Google Tag Manager by clicking Templates -> New Variable Template -> Click three dots in the top right corner -> Click import -> Add template that you’ve recently downloaded -> Click Save.

2. Specify the output type: choose the type you want to convert your data into.

3. Set value you want to convert to specified type.

For example you can convert 22.22 to integer and get 22.

Once these settings are configured, the variable will automatically convert any input value to the specified output type whenever the variable is referenced within the GTM Server Container.

Conclusion:Copy link to this section

The beauty of the Type Convertor Variable is its simplicity. It provides a straightforward solution to a common data problem, seamlessly transforming data types and ensuring that your analytics and reporting tools get the exact type of data they need.

Need help setting up server GTM?

We've got you covered! Click Get help, fill-up the form, and we will send you a quote.

Get help
Tagged with:gtm server

Host your GTM server at Stape