elmatador
elmatador

Reputation:

How to determine where a user came from to my site?

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.

Upvotes: 3

Views: 9796

Answers (6)

Arne Burmeister
Arne Burmeister

Reputation: 20594

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!

Upvotes: 0

Brian Rasmussen
Brian Rasmussen

Reputation: 116411

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.

Upvotes: 0

SLaks
SLaks

Reputation: 887479

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 spelled Referrer)

Upvotes: 6

Aziz
Aziz

Reputation: 20705

"Referer" field in the HTTP header

Upvotes: 7

colithium
colithium

Reputation: 10327

What you're looking for is the Referrer. Look up platform specific info to find out how to use it.

Upvotes: 3

olle
olle

Reputation: 4595

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.

Upvotes: 1

Related Questions