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.
- 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
+.
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 |
The variable logic is built to handle inconsistent data sources common in web tracking.
- Input:
"Österreich"or"Austria" - Output (Alpha-2):
AT
- Input:
"DEU"(Alpha-3) - Output (Numeric):
276
- Input:
"Schweiz"or"CH" - Output (Prefix with +):
+41
- Input:
"España" - Output (Alpha-2):
ES(Handles theñinternally)
- 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").
- 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).
- Download the
template.tplfile. - In GTM, go to Templates > Variable Templates > New.
- Click the three dots (top right) > Import.
- Select the file and Save.