Monday, December 1, 2008

Get Location details of Site visitors

Scott Hanselman wrote an interesting post about "How to find the location of the website visitors".

http://www.hanselman.com/blog/TheWeeklySourceCode37GeolocationGeotargetingReverseIPAddressLookupInASPNETMVCMadeEasy.aspx

Fast Abstract:

Many Paid solutions / services are available.  In case of free available services, Scott is saying about, two approaches.

One: Server-side work: Using http://www.hostip.info/

If we are sending IP address to this site's API, they are returning an xml document with location information. It is community based one, user provided data.

Two: Client-side work: Using Google AJAX API

<script src="http://www.google.com/jsapi?key=YOUR_API_KEY" type="text/javascript"></script>

<script>

google.load("jquery", "1.2.6");

google.load("jqueryui", "1.5.2");

var yourLocation = google.loader.ClientLocation.address.city + ", "

+ google.loader.ClientLocation.address.region;

</script>

Just need to do simple registration from google site. This is working fine, yes, for me provided my ip location correctly.

And If you find any further solutions OR updated information on this, please let me know via ‘comments’.

0 comments: