User Location Object
The userLocation
request object contains properties that specify the geographic location of the client that initiated a given request. The IP address of the requesting device determines the client's location. If the HTTP request contains an X-Forwarded-For
header, this header will be used to provide the location. Otherwise the connecting IP address will be used.
For more information, see the EdgeScape documentation available in the Download Center.
areaCodes
Returns a userLocation
object that specifies the area codes of the incoming request. Multiple values are supported. This is a read-only Array.
// Request originates in the city of Cambridge
request.userLocation.areaCodes;
// => [ "617" ]
bandwidth
Returns a userLocation
object that estimates the expected bandwidth of the incoming request. Refer to the Bandwidth range file for syntax. This is a read-only string value.
// Estimated bandwidthh of the incoming request.
request.userLocation.bandwidth;
// => "257"
city
Returns a userLocation
object that specifies the city name, within a 50-mile radius, of the incoming request. For synax, you can download the Cities ZIP file from the EdgeScape Datacodes. This is a read-only string value.
// Request originates in the city of Cambridge
request.userLocation.city;
// => "CAMBRIDGE"
continent
Returns a userLocation
object that specifies the two letter code for the continent of the incoming request. Refer to the Continent Code list for syntax. This is a read-only string value.
// Request originates in North America
request.userLocation.continent;
// => "NA"
country
Returns a userLocation
object that specifies the ISO-3166, two letter code for the country of the incoming request. Refer to the Country Code list for syntax. This is a read-only string value.
// Request originates in United States
request.userLocation.country;
// => "US"
dma
Returns a userLocation
object that specifies the DMA value of the incoming request. The DMA value is a mapping of major American metropolises to containing and neighboring states. Refer to the DMA list file for syntax. This is a read-only string value.
// Request originates in Boston
request.userLocation.dma;
// => "506"
fips
Returns a userLocation
object that specifies a 5 digit numerical code for the incoming request. The FIPS code helps to map counties to states. Multiple values are supported. Refer to the FIPS codes file for syntax. This is a read-only Array.
// Request originates in Massachuseetts
request.userLocation.fips;
// => ["25"]
latitude
Returns a userLocation
object that specifies the latitude of the incoming request.
This is a read-only string value.
// Request originates from Akamai headquarters
request.userLocation.latitude;
// => "42.364948"
longitude
Returns a userLocation
object that specifies the longitude of the incoming request.
This is a read-only string value.
// Request originates from Akamai headquarters
request.userLocation.longitude;
// => "-71.088783"
networkType
Returns a userLocation
object that specifies the network type of the incoming request. Refer to the Network type codes for syntax. This is a read-only string value.
// Request originates from a mobile network
request.userLocation.networkType;
// => "mobile"
region
Returns an ISO-3166, two-letter code for the state, province, or region of the incoming request. Refer to the State/Region Code list for syntax. This is a read-only string value.
// Request originates in the state of Massachusetts
request.userLocation.region;
// => "MA"
timezone
Returns a userLocation
object that specifies the timezone of the incoming request. Refer to the Timezone list for syntax. This is a read-only string value.
// Request originates from the Greenwich Mean Time time zone
request.userLocation.timezone;
// => "GMT"
zipCode
Returns a userLocation
object that specifies the zip code of the incoming request. Contiguous zip codes are represented as a range "FirstZipInRange-LastZipInRange". Multiple values are separated by the plus (+) character. For example, the following strings are all valid zipCode values:
-
10001
-
10001+10003
-
10001-10003+10005
-
10001-10003+10005-10008
For country = US and country = PR, zip refers to the five digit zip code. For
country = CA, zip refers to the Forward Sortation Area (FSA). For more information on
FSA, go to http://www.canadapost.ca and search for FSA. Refer to the Zip Code list for syntax. This is a read-only string value.
// Request originates in a Cambridge zipcode
request.userLocation.zipCode;
// => "02114+02134+02138-02142+02163+02238"
Updated 4 days ago