I suggest using Google Analytics to your problem, but if you want to try yourself here is a starting point:
Take a look at this link http://www.geoplugin.net/php.gp, you get a full list of details about that ip address position, including latitude and longitude.
It is not that acurate but it works, and I use it. Here is a php script actually in use :
You can see it working at http://whateverhappens.org/ip-addr/
And that a look at the Geoplugin website examples.