client.geo.region.ascii

STRING, read-only.

Available in all subroutines.

ISO 3166-2 country 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

Here are some example values:

var.codeRegion NameCountryISO 3166-2 subdivision
AXÖdkarbyÅland Islands(none)
DE-BEBerlinGermanyLand (State)
GB-BNHBrighton and HoveUnited KingdomUnitary authority
JP-13東京都 (Tōkyō-to)JapanPrefecture
RU-MOWМосква́ (Moscow)Russian FederationFederal city
SE-ABStockholms länSwedenLän (County)
US-CACaliforniaUnited StatesState

Here, the region name is given for sake of reference only. The region name is not provided as a VCL variable.

User contributed notes

We welcome comments that add use cases, ideas, tips, and caveats. All comments will be moderated before publication. To post support questions, visit our support center and we'll find you the help you need.