How to determine a web visitor's country of origin?
March 13, 2006 4:59 PM   Subscribe

Is there an easy, free way for me to figure out which country a website visitor is coming from? Or more specifically, if a user is not in the US?

I'm aware of this IP to country list, but it costs 75 bucks. I'm also aware of ISP domains that end in country domains, but this doesn't always cut it. I basically want to be able to toggle a PHP variable so that if the person is viewing from the US, they get content X, if not, they get content Y. Thanks!
posted by gramcracker to Computers & Internet (9 answers total)
 
That's pretty bad form, in my opinion, and bound to be less useful than not doing it at all. Try these things.
posted by kcm at 5:05 PM on March 13, 2006


Maxmind has a free locator that is a lite version of there for sale version. many Linux distros have packages for it making install pretty easy. You can also download and install it yourself to use. Haven't compared it to the for money version, but seems to work pretty well.
posted by chrisroberts at 5:07 PM on March 13, 2006


OK, so you didn't explicitly say it was for language detection, now that I re-read. Still.. other than checking against a list of ASNs or paying for a commercial database, I guess you could use Akamai (also costly).
posted by kcm at 5:08 PM on March 13, 2006


I second the Maxmind free offering; it's used in AWStats and it's always been accurate enough for my basic stats needs.
posted by Remy at 5:28 PM on March 13, 2006


Response by poster: I want to use it to auto-default to a certain units for a calculator; the US uses one standard unit form, while the rest of the world uses another.
posted by gramcracker at 5:35 PM on March 13, 2006


GeoIP is free for just country lookups and has bindings to many languages (e.g. perl, php, etc.)

That said I wouldn't use it for anything crucial, because its accuracy is not all that great.
posted by Rhomboid at 5:47 PM on March 13, 2006


statcounter.com , even without java it will tell you IP, country/city and browser, which was cool until myspace started crunching their URL :(
posted by psychobum at 10:58 PM on March 13, 2006


The IP-To-Country database is free of charge at http://ip-to-country.webhosting.info/. We use it for non-crucial purposes on sites and have no complaints.
posted by Hartster at 1:33 AM on March 14, 2006


SlimStat includes the country to IP database as well if you wanted to see some code in action. As others have said, I wouldn't bet my life or finances on its accuracy.
posted by phearlez at 9:00 AM on March 14, 2006


« Older I'm giving up on Dreamhost. Webhosting...   |   Website to track body measurements? Newer »
This thread is closed to new comments.