use cookies for that
simply update the cookie stored in user's browser each time he comes to the site
only problem will be the deleting of the cookies by the user
but for random statictics this method is used