Stape/Documentation

MD5 Hash variable

Updated Aug 6, 2025

The MD5 Hash variable for server-side Google Tag Manager can generate the MD5 Hash of an input value. Many applications require hashed data, e.g., to work with encrypted data or store sensitive data, which is exactly what the MD5 Hash allows you to do.

Note: please keep in mind that the MD5 Hash variable works only with Stape-hosted sGTM containers.

Benefits of using the MD5 Hash variable

  • Secure data handling: instead of passing sensitive information (like emails) in plain text, you can hash values before sending them to third-party tools, reducing privacy and security risks.
  • Better compliance with regulations: hashing personal identifiers helps align tracking setups with privacy standards such as GDPR and HIPAA, since you avoid exposing raw user data.
  • Consistent, lightweight identifiers: the MD5 algorithm creates a fixed-length hash from any input, making it easy to generate unique, consistent identifiers for user matching, deduplication, or analytics without storing the original values.

Requirements for setting up the MD5 Hash 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 MD5 Hash 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 MD5 Hash variable template in the server GTM container by importing it from the Template gallery:

  • Search for the MD5 Hash variable by Stape in the Google Tag Manager Variable Template gallery.
  • Click Add to workspace.
Search for the MD5 Hash variable by Stape
Search for the MD5 Hash variable by Stape

3. Create the MD5 Hash variable:

  • Go to the Variables menu → click New.
The Variables menu
The Variables menu
  • Click Variable Configuration → select MD5 Hash.
Select the MD5 Hash variable
Select the MD5 Hash variable

4. Configure the MD5 Hash variable

  • Value to be hashed - enter the value that you want to hash using the MD5 algorithm.
  • Logs Settings - choose if you want to log requests to your Stape account. This feature is handy when setting up server-side tagging since it allows seeing incoming and outgoing requests and network responses.
  • BigQuery Logs Settings - allows you to configure BigQuery logging.
  • Format Value - configure how to format the value that will be output by this variable.
Configure the MD5 Hash variable
Configure the MD5 Hash variable

Finally, give your variable a descriptive name and click Save.

How to test and troubleshoot the MD5 Hash 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.

Testing and troubleshooting the variable
Testing and troubleshooting the variable

Comments

Can’t find what you are looking for?