@location
Description
The @location context query describes information about where the user viewing the current ad is located. Use this context query to have your ad respond to the current DMA, city, region, country, etc.
Example Usage
For example, you wanted to use a contextually relevant background image depending on what city the user is currently located in. You could use the city and region contexts to do just that.
.component {
/* Default */
background-image: url(/assets/generic-skyline.jpg);
/* Chicago */
@location (city: chicago) and (region: il) {
background-image: url(/assets/chicago-skyline.jpg);
}
/* New York */
@location (city: new_york) and (region: ny) {
background-image: url(/assets/ny-skyline.jpg);
}
/* Los Angeles */
@location (city: los_angeles) and (region: ca) {
background-image: url(/assets/la-skyline.jpg);
}
}
Available Features
| Feature Name | Javascript Name | Value | Example Value | Description |
|---|---|---|---|---|
city | locationCity | string | chicago | The name of the city where the request is coming from. All lower-case, spaces should be replaced by an underscore (e.g. new_york). |
region | locationRegion | string | il | The two letter abbreviation of the state or region where the request is coming from. |
country-code | locationCountryCode | number | us | The ISO Alpha-2 Code of the country where the request is coming from. Please see full list here. |
dma | locationDma | number | 602 | The DMA code of the geographical market where the request is coming from. Please see full list here. |
latitude | locationLatitude | number | 41.878114 | The latitude of the location where the request is coming from. |
longitude | locationLongitude | number | -87.629798 | The longitude of the location where the request is coming from. |
Updated less than a minute ago
