client.geo.region.ascii
STRING, read-only.
Available inall subroutines.
This variable exposes the country subdivision code found in ISO 3166-2. By default, this does not display the two-part country and subdivision code. For countries with multiple levels of subdivision (for example, nations within the United Kingdom), this variable gives the more specific subdivision.
The special value NO REGION
is given for countries that do not have ISO country
subdivision codes. For example, NO REGION
is given for IP addresses assigned
to the Åland Islands (country code AX
, illustrated below).
These region values are the subdivision part only. For typical use, a subdivision is normally formatted with its associated country code. The following subroutine illustrates constructing an ISO 3166-2 two-part country and subdivision code from the respective variables:
sub client_geo_code STRING { declare local var.code STRING;
if (client.geo.country_code != "**") { set var.code = client.geo.country_code; if (client.geo.region != "NO REGION" && client.geo.region != "?") { set var.code = var.code + "-" + client.geo.region; } }
return var.code;}
Examples
Based on the above code block, here are some example results:
var.code | Region Name | Country | ISO 3166-2 subdivision |
---|---|---|---|
AX | Ödkarby | Åland Islands | (none) |
DE-BE | Berlin | Germany | Land (State) |
GB-BNH | Brighton and Hove | United Kingdom | Unitary authority |
JP-13 | 東京都 (Tōkyō-to) | Japan | Prefecture |
RU-MOW | Москва́ (Moscow) | Russian Federation | Federal city |
SE-AB | Stockholms län | Sweden | Län (County) |
US-CA | California | United States | State |
Here, the region name is given for sake of reference only. The region name is not provided as a VCL variable.