Help Center Manage Your Account Ad Targeting using Restrictions

Geolocation API

Geolocation API of HTML5 can be used to provide accurate latitude and longitude values for ad serving. By default, our ad server maps an IP address to the physical location for geotargeting. However, IP-based mapping has its limitations. Accuracy is very high at the country level but can be less accurate at the city level, depending on the country and data coverage. This is because of several factors: IP addresses are assigned and moved from one location to another location frequently by their Internet service providers. Also, many users behind a web proxy can share the same public IP address. Geolocation API can also solve the issue with image proxy servers in email ad serving.

Geolocation API solves this problem by gathering additional information, including surrounding Wi-Fi networks. Visitors allow only trusted websites to know their geographical locations and the visitor needs to explicitly allow his/her location to be disclosed. Your location-aware website would get this information from the visitor's browser and append it to the ad tag and it will be used instead of the visitor's IP address. In order to use this feature, you must obtain explicit consent from the viewer before getting his/her coordinate data.

HTML and JavaScript

Here is a simple example to get the latitude and longitude value using Geolocation API.
<script type="text/javascript">
function getLocation() {
  if (navigator.geolocation) { // detection
    navigator.geolocation.getCurrentPosition(function(pos) {
      alert(pos.coords.latitude);
      alert(pos.coords.longitude);
    });
  } else {
    // Geolocation API not available
  }
}

Ad Tag Parameters

To enable geolocation in the ad serving tag, set the latitude value with parameter "aslat", longitude value with parameter "aslong", and a token with parameter "asgeo". A token is required when appending the latitude and longitude value into the serving code. Please contact us to request this token for your account and to agree to obtain user's consent on your end.

Examples

Here is a request for a visitor in San Jose:
/ad.php?do....&aslat=37.339386&aslong=-121.894955&asgeo=[TOKEN]
Here is a request for a visitor in Atlanta:
/ad.php?do....&aslat=33.748995&aslong=-84.387982&asgeo=[TOKEN]

Other Articles in Ad Targeting using Restrictions

Learn about ad targeting and restrictions ad serving such as frequency capping, geo-targeting, quota, roadblock, flight date, etc.

Cannot find an answer for your question? Ask our Customer Care team

Related