Using Location Awareness

A future web design trend that I predict is location awareness, and using it to ensure a better user experience. However without access to GPS, most of the world’s desktop PCs will have to rely on other means of telling servers where they are. One way that we can use today to determine the location of any given computer is by using a user’s IP address and feeding it to a service that will tell us where the computer is located. Now while this sounds great in practice, in reality most services aren’t all that accurate. But saying that, most can tell you what country a user is visiting from. So how can we use this is web design?

Well say for instance you have two e-commerce sites that are essentially the same shop – one for your American audience, and one for the UK. Differences might include currency conversions and product listings, and it would be nice to be directed to the right site should you accidentally visit the wrong one. For example Crucial’s website alerts the user with a nice little pop-up, asking them if they would like to visit their international site, as it were, as you can see below.

Crucial Popup

This sort of interaction is really beneficial to the user because it stops them making mistakes later on, and more importantly, it’s easy to accomplish!

Now instead of presenting you with all the code, I’m going to tell you how I accomplished the desired effect – hopefully I’ll make you actually think about how it works 🙂

So first off I visited this code snippet page to get my code for finding out where the user is. I then took the array filled with information and used an “if” statement to evaluate it. So something like…

if($ipInfo["country"]=="GB - United Kingdom"){
  echo '<script type="text/javascript">popup();';
}

The code above will initiate a JavaScript function if the user appears to be coming from the UK. This function would do anything you want really, I would suggest you use a nice pop-up box to alert the user, much like the one shown above, and then allow them to navigate to another site. I would argue against immediate redirection, because the reliability of a free database cannot be ensured, and you wouldn’t want to be redirected to the wrong site without the option to navigate back, now would you?

As I said, this is a really easy way of determining where your users are, and making a decision based on that information. Users will thank you for helping them out, and admire the fact that you know where they live!*

*Users may not be impressed by this simple technique 😉


Posted

in

by