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