How to track user activity on a website without requiring login

cookiesip addressyelp.com

I was just searching for a review on Yelp and I saw these (Useful, Funny, Cool) evaluation tags for a review. I was able to mark them even when I was not logged in, still they would retain the way I marked them even if I open a new browser window, or a private browsing session.

How is this done? I mean how does it track user activity without requiring me to login/signup?
I don't know if its cookies or the site stores my IP address or a combination of both?

Best Answer

Storing this in cookies/session is the way to go. In PHP you can just use the $_SESSION functionality to do this. More info on that here.

This will not work if the user opens a private browsing session, though. IP tracking would work, but IP addresses change due to ISP assignments and may represent different users (for example, two users in one home sharing the same DSL connection). For these reasons this is not recommended.