Yes, HTTP_REFERRER only carries information about where the latest action, which would mean your site after the first page request. However, you can't rely on it to always be set.
And yes, you need to somehow keep track of your users while they're on your site. You could set a cookie for this purpose, but since cookies arent always allowed, it won't give you 100% coverage. You could also go for sessions with session id being passed around in the query string. From a security perspective, this isn't that good, but if all you need is tracking information, that shouldn't be an issue.