
Ask HN: Determine what website client was on - ge96
I don&#x27;t know why I&#x27;m not sure if you can do this.<p>I just want to know for analytics purpose where a connecting client came from. Is that something you would know from say HTTP?<p>I use PHP right now for backend. I can get IP&#x2F;requested URL, I just for some reason assumed you can do this. I mean if you think about Google they are running a browser so this information is probably easy to get&#x2F;makes sense to have.<p>But I mean when you leave one server, how would another server know which server you were just connected to?
======
gt565k
[https://en.wikipedia.org/wiki/HTTP_referer](https://en.wikipedia.org/wiki/HTTP_referer)

~~~
ge96
Thanks

------
joshyi
Use something like [https://goaccess.io](https://goaccess.io)

------
timdavila
In PHP, you're looking for

    
    
      $_SERVER['HTTP_REFERER']

~~~
ge96
Nice! I saw this in a StackOverflow post, it's odd that it would work that way
don't you think? (probably not) but I think say you are A, and you connected
to B (Facebook) and you then connect to C (YouTube), why would you not see A
instead of seeing B at C?

Anyway thanks

