Silent-monk has asked for the wisdom of the Perl Monks concerning the following question:

Greeting monks,

The marketing department here at work would like to keep track of our website's visitor location trough their IP.

I found the Geo::IP module on CPAN and I wonders if any monks gave it a is it actually acurate enough to be worth the effort to implement it or would you suggest a different way of achieving the IP location ?

Thanks

Replies are listed 'Best First'.
Re: Geo::IP module
by mirod (Canon) on Aug 18, 2006 at 20:19 UTC

    I use IP::Country::Fast and Geography::Countries for this kind of task, and they give some results. Whether these results are accurate or not... who knows? I am sure marketing will be happy with one more statistics though, so go ahead and implement!

Re: Geo::IP module
by Old_Gray_Bear (Bishop) on Aug 19, 2006 at 01:03 UTC
    I am afraid I have some unpleasant news for your Marketing folks -- The IP address ain't a Location, not in the geographical sense, anyway.

    The "address" you get back is the physical location of the origin of the IP packet stream. If that origin is a single physical machine directly connected to the Net, then you really do have the geographic address of the user.

    But what if the IP address corresponds to a firewall with NAT addressing? Now the geographical address doesn't point you to the physical address of the individual users, only to that of the firewall machine(s) they sit behind. All Users behind that firewall appear to come from the same physical location.

    Consider: if your visitor is a Comcast user, then the address of their server is someplace in the USA (outside of Herndon Virginia, I think), but the actual user can be anywhere in the United States. AOL or Yahoo! users will appear to originate from one of two places - one in Virginia, the other outside of San Francisco. It depends on which hemisphere they connected from. Sigh.

    But Wait! It get's worse.

    You can query the WhoIs database to get the Registry information. That includes the mailing address, right? Yup, but that mailing address is the one that was given at the time that the domain name was registered. Most (all?) Registeries send their 'you are about to expire' notices out in e-mail. They almost never bother to send surface-mail. And the mailing address gets updated when someone remembers to. I just looked at my home Domain, the address it lists is eight years old; I know, because I moved out of that dump in early 1999.

    The Net has redefined the concept of 'distance'. I am physically on the West coast of North America. I am as close, on the Net, to Redmond, Washington, as I am to Tokyo, Japan, about 200 milli-seconds each. I am farther from my brother-in-law in Oregon at 320 milli-seconds; even though he is only 400 miles away. The Internet has collapsed Physical Space into the Time dimension.

    There is really no way to relate the IP address to the physical location of the User, not any more. The best you can say is: "they are somewhere on this planet....".

    ----
    I Go Back to Sleep, Now.

    OGB

      Greetings monks!

      That's nice information. Since the point isn't to be 100% acurate but to get an overall idea, I can implement the desired locator and tell the marketing division why they shouldn't rely too much on it!

      Thanks a million !

Re: Geo::IP module
by starbolin (Hermit) on Aug 18, 2006 at 21:28 UTC

    Define accurate. My ISP lists me as connected to a Redback which is 73 miles away. (Life in a small town.) When I want privacy, or to access difficult servers, I can browse via a shell account which is hosted from a location across the continent. On the whole howerver IP location will tell you what region of the country most of your logins are from. Just make sure the users know the data can't distinquish between city vs rural, or between nearby cities.


    s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}