Knowing your audience is key when putting together your company’s website, and one of the first questions you’ll want to ask new visitors is, “Where are you from?”
To answer that question, we can leverage the power of geolocation. Geolocation is a method of establishing your visitors’ geographical location in order to customize each user’s experience. The technology behind geolocation is actually as old as the Internet itself. Each computer connected to the Internet is assigned a number called an IP address. This number is used by web servers to correctly route responses and requests to/from each site visitor. And because of the way these IP addresses are distributed, it is possible to gather real-world geographical data just by examining a user’s IP.
Say you want to provide a map of all your stores on your website, and you want to show the locations closest to your user. By geolocating your user first, you can load up the map with nearby results right away. Sites like DealChicken.com use geolocation to route their users to the appropriate city/state page of listings the moment they enter the site. If your site has advertising, geolocation is a great way to target ads to a specific segment of your user base.
In the past, setting up geolocation on your site meant maintaining a huge database of IP addresses and map coordinates, but thanks to a web service called geoPlugin (and others like it), those days are well behind us. We can make a request to the geoPlugin service simply by visiting a web page:
http://www.geoplugin.net/json.gp
This page gives us a well-structured dataset we can immediately use to gather geodata. The best part is, the service is free to use for up to 100,000 daily lookups!
Now we know how to use this powerful tool, it’s important to consider when not to use geolocation. The techniques we’ve discussed here cannot reveal a user’s identity or even their street address/house number – when taking orders for products for example, you’ll need the user to enter a valid shipping address instead of relying on any geolocation data you’ve gathered. Also, if you have a mobile version of your site, geolocation by IP address on a mobile device may produce unexpected results, though solutions like the HTML5 Geolocation API and device-specific GPS services help to bridge this gap. As with any tool, IP-based geolocation is not suited to every job, but it can prove to be a valuable part of your user targeting strategy.
Geolocation is a quick, unobtrusive way to enable your site to show relevant content to your users more quickly. If you have ideas about using geolocation in your next web project, we’d love to hear them!