Tracking Users By IP Address

Peter L Hansen peter at engcorp.com
Thu Oct 7 12:54:19 CEST 2004


Fuzzyman wrote:
> Ok so this is really an HTTP question... but I'd far rather ask it
> here !! If I don't get an answer I'll have to try elsewhere I guess
> :-(
> 
> I'm developing a simple web user statistics program and I'd like to
> gather information like number of pages a user views per visit. This
> way I can distinguish between number of visits and number of page
> views. 
> 
> Assuming that each visitor will have a unique IP address is probably
> not 100% accurate but will have a reasonably low margin of error !! Is
> there any reason not to use this approach ?

Depends on your user base, I guess.  If I expected many visitors
from corporate environments, I'd not think this approach would
have a "reasonably low margin of error".  Almost any such
environment will have a firewall and masquerade multiple users
as the same address.

If you used this approach but made sure to have a reasonably
short timeout before you discarded the address information, say
about ten minutes of "no access" from the address, then you
would be less likely to mix up multiple users from the same
site accessing your web pages in quick succession.

You could also try setting a cookie to help track them, just
within a session, and I suspect most corporate environments
still have basic cookies turned on...

-Peter



More information about the Python-list mailing list