I remember having seen somwhere that it is possible to tell where a user came from to a website. More specifically, I want to determine the (Google etc.) search that led to my site. How can I do that?
As far as I know the HTTP protocol, nothing like this is sent to the server in a GET request, so I also wonder how it is done technically.
"Referer" field in the HTTP header
What you're looking for is the Referrer. Look up platform specific info to find out how to use it.
The client may set the Referer field as part of the HTTP header to indicate the referring page. However, as with everything else that the client controls this cannot be viewed as anything but an indication. It is not always set and the client may fake the data, so keep that in mind when using client data.
The Referer HTTP Header contains the URL of the site containing the link clicked on. But it is sent by browsers only and in can be suppressed by security settings!
You need to check the
Referer
header. [sic]When a user clicks a link in a webpage, the browser sets the
referer
header of the request for the link's target to the page that contained the link.If a user came to your site from a Google search, this header will be a url in Google.com.
However, for privacy reasons, some browsers do not send this header.
Referer
was misspelled in the original HTTP implementation, and the mispelling stuck. (It should be spelledReferrer
)sign up for google analytics for free to get those statistics and a whole lot more. Seeing where someone came from is done by checking the http referer header.