Phone Number Formatter variable allows you to format phone numbers into a standardized format, such as E.164, which is commonly used in international telecommunications. It can be particularly useful when you need to ensure that phone numbers collected from various sources (e.g., form submissions, data layers) are consistently formatted before being sent to external systems like CRMs, analytics tools, or other third-party services.
In this blog post we will discuss how Phone Number Formatter variable works and how to set it up for both: server and web Google Tag Manager containers.
The initial development of these templates was done by Lars Friis, and it is now maintained by Stape.
Phone Number Formatter Variable works by taking two inputs:
The variable processes the inputs and converts the phone number into the desired standardized format. It changes the libphonenumber library (developed by Google) to correctly interpret and format the phone number based on the country code provided.
1. Download:
2. Import the variable to your Google Tag Manager container by clicking: Templates → New Variable Template → Click three dots in the top right corner → Click import → Add template that you’ve recently downloaded.
3. Configure the variable, by adding Phone Number and Country Code. Click Save.
This setup will help you maintain consistent phone number formatting across your various data flows within the Google Tag Manager container. And if you need help with the setup - don’t hesitate to ask for the audit or a consultation.
We are happy to hear that! Click on Try for free to register and check all the possibilities.