Real Boolean variable
Updated Jul 30, 2025
The Real Boolean Variable is a custom variable template for the Google Tag Manager server container that allows you to return a strictly typed boolean value - true or false. Unlike standard approaches in GTM where values may be returned as strings (e.g., "true" or "false"), this variable ensures consistent and accurate boolean output by avoiding JavaScript type coercion issues.
Handful for passing data to server-side tags, controlling conditional logic in templates, and making your setup cleaner and more robust. Use this variable to improve how true/false values are handled throughout your server-side GTM container.
Benefits of using the Real Boolean variable
- Strictly typed values: eliminate ambiguity and prevent bugs caused by loose type checking (e.g., strings vs booleans). This is especially helpful when working with tag templates or APIs that require actual boolean values.
- Improved template performance: by ensuring consistent data types, this variable reduces processing ambiguity and makes templates more predictable and easier to debug.
- Ease of use: no coding required, just add the variable to your server container and select whether it should return true or false.
- Better tag behavior: some third-party platforms and custom tags behave differently depending on the data type. Ensuring a boolean output helps maintain integration compatibility and expected behavior.
Requirements for setting up the Real Boolean variable
Please ensure that you already have Google Tag Manager web and server containers, as well as a configured server container and custom domain in Stape. Please follow these guides if you don’t have any of those:
How to set up the Real Boolean variable
1. Configure sending data to the server GTM container. The two most popular options for sending data to sGTM are Google Analytics 4 and Data Tag/Data Client. Here is a step-by-step guide on sending data to sGTM.
2. Add the Real Boolean variable template in the server GTM container by importing it from the Template gallery:
- Search for the Real Boolean variable by Stape in the Google Tag Manager Variable Template gallery.
- Click Add to workspace.

3. Create the Real Boolean variable:
- Go to the Variables menu → click New.

- Click Variable Configuration → select Real Boolean.

4. Configure the Real Boolean variable:
- Value - choose whether the variable should return true or false.
- Format Value - select from the options to format the value that will be output by this variable.

Finally, give your variable a descriptive name and click Save.
How to test and troubleshoot the Real Boolean variable setup
You can test the configurations in Google Tag Manager. Click on Preview and trigger the event where you use the variable. Then navigate to the Variables tab and check the variable you have created and its value.

Find out more about debugging and monitoring server-side tracking configuration in our guide.
Comments