Guide: Phone Number Normalization & SHA256 Hashing for GTM Server-Side
Phone NormalizerPhone HashingStandard Format
This variable template normalize & hash any phone/mobile number with SHA256 after formatting the value to the desired format. i.e. removing leading zero, plus sign, dashes, brackets, white spaces.
Overview
The Phone/Mobile Normalizer & SHA256 Hasher is a high-performance utility for Google Tag Manager Server-Side. Its primary purpose is to sanitize “messy” user-inputted phone numbers and transform them into a standardized, privacy-compliant SHA256 hash.
Configuration Checklist Explained
Each configuration setting in the Phone/Mobile Normalizer SHA256 Hasher variable allow you to clean the phone data so it matches the strict formatting required by advertising and analytics platforms.
Prerequisites & Permissions
Before installation, ensure your GTM environment and user access levels meet the following requirements:
Container Type
- GTM Server-Side Only: This variable uses the
sha256SyncAPI, which is exclusive to Server containers. It will not function in a Client-Side GTM container. - You can check it on your account’s container type or on admin tab container settings Target platform.
User Access Levels
- To use and install the templates, you must at least has Editor or Edit permission.
Installation & Configuration
Step 1 : Import the Variable Template
This step installs the specific logic required to clean and secure phone numbers, as standard GTM variables do not have the built-in capability to perform complex normalization or SHA256 hashing natively.
Step 2: Configure the Normalization Settings
This step defines a specific “source” for the raw phone number within your server’s incoming data, ensuring the normalizer has a clear and consistent input to process.
Step 3: Create the Normalized Phone Variable
Now that you have captured the raw phone data, you must create a new variable to apply the cleaning and hashing logic. This step connects your incoming data source (the variable from Step 2) to your formatting and hashing logic.
Step 4: Define the Event Trigger
We must tell GTM exactly when this action should happen. The trigger will execute or send the hashed phone number to Google’s servers.
Step 5: Mapping the Variable to your Tag
Once your normalized variable and trigger are ready, you must attach it to your tag to ensure the secure data is transmitted during events (like a login or purchase). This step ensures that tag receives the pseudonymized phone number as part of the event metadata.
Testing & Validation (Preview Mode)
Before publishing your container, you must verify that the phone number is being correctly captured, normalized, and hashed.
Conclusion & Next Steps
Congratulations! You have successfully configured a privacy-first, server-side normalization pipeline for your phone data. By moving this logic to the server, you’ve not only improved your Data Match Quality for GA4 and Google Ads but also ensured that sensitive customer information is securely hashed before it ever reaches third-party platforms.
Final Success Checklist:
Need further assistance?
If you encounter any issues with specific data layer structures or advanced formatting requirements, feel free to reach out to our support team by sending us a message below or consult the official Google Tag Manager Server-Side documentation.
Targeting better attribution, one secure hash at a time.
























