Variable TemplateWeb Container

Heytag EEA/EFTA Country Converter (Web)

Universal converter for EEA and EFTA countries. Converts country names to ISO 3166-1 (Alpha-2/3, Numeric) or E.164 telephone country codes. Includes support for Switzerland and automatic umlaut normalization.

A lightweight and robust Google Tag Manager (Web) variable template designed to standardize country data. It transforms various country inputs into standardized ISO formats or E.164-compliant phone prefixes, specifically optimized for the European Economic Area (EEA) and EFTA states.

Key Features

  • Multi-Language Recognition: Recognizes country names in English, German, and their respective native languages.
  • Normalization: Automatically handles umlauts (ä, ö, ü) and special characters (ß), converting them to standard Latin characters for better matching.
  • Flexible Input: Accepts full country names, ISO Alpha-2, or ISO Alpha-3 codes as input.
  • E.164 Support: Provides international dialing prefixes with or without the leading +.

Supported Countries (EEA & EFTA)

The transformer covers all 27 EU member states, the 3 additional EEA members, and Switzerland (EFTA).

Transformation Use Cases

The variable logic is built to handle inconsistent data sources common in web tracking.

Case 1: Name to ISO Code

  • Input: Österreich or Austria
  • Output (Alpha-2): AT

Case 2: Cross-ISO Conversion

  • Input: DEU (Alpha-3)
  • Output (Numeric): 276

Case 3: Phone Number Standardization

  • Input: Schweiz or CH
  • Output (Prefix with +): +41

Case 4: Normalization of Special Characters

  • Input: España
  • Output (Alpha-2): ES (Handles the ñ internally)

Case 5: Empty or Unknown Inputs

  • Input: "" or USA
  • Output: Returns the configured Default Return Value (or undefined).

Multilingual Support: This template is available in German and English. It recognizes country names in both languages (e.g., it accepts both "Deutschland" and "Germany").

Configuration

  • Input Value: Select the GTM variable containing the raw country data.
  • Output Format: Choose between ISO Alpha-2, Alpha-3, Numeric, or Phone Prefixes.
  • Default Return Value: Define what should happen if no match is found (e.g., for non-EEA countries).

Installation

  • Download the template.tpl file.
  • In GTM, go to Templates > Variable Templates > New.
  • Click the three dots (top right) > Import.
  • Select the file and Save.
Back to overview