views:

73

answers:

2

A single user can show up as multiple unique users over a period of time when he vists a site. Internally, the user's IP address is static, but on the net the user is represented by the ISP router's IP address, isn't it?

+3  A: 

You can't be guaranteed that a user is unique by IP Address.

Companies might be operating behind a firewall/proxy so all requests will come from that single IP.

Probably your best bet would be to drop a cookie on to the users browser when they browse to the site, and then check for the existence of that cookie on subsequent visits.

But even this doesn't guarantee you as there is nothing to stop the user from clearing their cookies in the browser, or visiting once from IE, and the next time from firefox.

In a nutshell, there's no guaranteed way... but there are ways to make a pretty good guess

Eoin Campbell
+2  A: 

For every client that comes to your site, assign him a unique ID and store it in a cookie. Then check for that cookie every time your site is hit, and set it if it is missing. Then you can log client usage by unique ID.

Usually the IP address you see from the client is the IP address the client's ISP has provided for him. These are often dynamic. Clients behind proxies and routers will share IP addresses. Either way, assigning a unique cookie to each client circumvents these problems.

It won't work for clients with cookies disabled. You'll have to default to the IP address for those, and risk the data being incorrect. Or you could just not log this kind of user, in which care your data will be incomplete. There's no reliable way to uniquely distinguish between every user, so you just have to pick which method makes the most sense for your site.

Welbog