Skip to content

heytag/heytag-eea-efta-country-converter-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Heytag EEA/EFTA Country Converter (Web)

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.

This template is developed and maintained by Heytag, a European server-side tagging provider based in Germany. Heytag empowers businesses to take full control of tracking data, improve website performance, and ensure GDPR compliance through high-performance, locally hosted infrastructure.

Explore how to unite privacy and performance at heytag.de.

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).

Country ISO Alpha-2 ISO Alpha-3 Numeric Dial Code
Austria AT AUT 040 43
Belgium BE BEL 056 32
Bulgaria BG BGR 100 359
Croatia HR HRV 191 385
Cyprus CY CYP 196 357
Czech Republic CZ CZE 203 420
Denmark DK DNK 208 45
Estonia EE EST 233 372
Finland FI FIN 246 358
France FR FRA 250 33
Germany DE DEU 276 49
Greece GR GRC 300 30
Hungary HU HUN 348 36
Iceland IS ISL 352 354
Ireland IE IRL 372 353
Italy IT ITA 380 39
Latvia LV LVA 428 371
Liechtenstein LI LIE 438 423
Lithuania LT LTU 440 370
Luxembourg LU LUX 442 352
Malta MT MLT 470 356
Netherlands NL NLD 528 31
Norway NO NOR 578 47
Poland PL POL 616 48
Portugal PT PRT 620 351
Romania RO ROU 642 40
Slovakia SK SVK 703 421
Slovenia SI SVN 705 386
Spain ES ESP 724 34
Sweden SE SWE 752 46
Switzerland CH CHE 756 41

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).

Tip

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

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

Installation

  1. Download the template.tpl file.
  2. In GTM, go to Templates > Variable Templates > New.
  3. Click the three dots (top right) > Import.
  4. Select the file and Save.

License

MIT

About

Universal transformer for EEA & EFTA countries. Converts names to ISO 3166-1 (Alpha-2/3, Numeric) or E.164 phone prefixes. Includes Swiss support and umlaut normalization.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages