client.geo.region.ascii

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 VCL fragment illustrates constructing an ISO 3166-2 two-part country and subdivision code from the respective variables:

1
2
3
4
5
6
7
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;
  }
}

Examples

Here are some example values:

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.

Type

STRING

Accessibility

Read Only

Readable From

All subroutines