3

As per title, the 'home page' of my website will differ depending on whether the user is unique or not (i.e. the user has never visited this site before).

I appreciate 'never' is not 100% accurate in either case of cookies or IP address as they may be cleared or reset, but they are the two most feasible options I'm aware of (I'm open to suggestions).

What is the recommended approach?

I doubt the answer would be opinion-based, but if it is too subjective please comment as such and I'll amend the question.

2 Answers2

6

Using the IP address would be a lot easier and more reliable, if only the IP address did identify a single user, but it doesn't. It identifies a node in the network, and that can either be a single computer or a router that connects many computers.

For example, everyone in a company is typically connected in a network, and accesses internet through a single router.

Also, most IP addresses are allocated dynamically. Some DHCP servers are configured to let users keep the same IP address as long as possible, but some don't. A dynamic IP address is assigned with a lease for a predefined time, which typically varies between an hour and two days, so many users get a different IP address several times a week.

Your best option is cookies. Eventhough they are not very accurate because of the limitations that you mentioned, it's a lot closer than using the IP address.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
2

As most domestic DSL doesn't provide static public IP, I think that the session cookie is better in order to keep a record of returning visitors.

Assuming you don't mind using another tool other than the very website you are building, tools like Piwik (free open source software) and Google Analytics provide this functionality.

versvs
  • 643
  • 2
  • 12
  • 30