Geographical Tracking

Hey, I’ve been looking into the Analog stats tracker and can’t find any geographical user data. I’m in need of geographic data for both US and international visitors, preferably by city, at the very least by state/country. Can anyone recommend a good application? My first choice would be to write my own, but I don’t know how to convert an IP to a location, can anyone help me out? Thanks!

I use AWStats, but it doesn’t zero in that much on cities or states; just countries. Even then, remember that such lookups put a load on the server. Every hit may require a lookup for your stats.