Question

Are there any HTTP Headers I could use to grab the entire referrer URL using a webserver/server-side scripting? Including query string, et cetera?

Was it helpful?

Solution

You should be able to grab it from the $_SERVER['HTTP_REFERER'] variable.

OTHER TIPS

To add to Chacha's point, I don't know if you want to capture the client side hash part of the referrer URL (sometimes, you do). I.e. if the client came from "http://www.domain.com?x=3#y=5", the $_SERVER['HTTP_REFERER'] will only contain "http://www.domain.com?x=3", and the hash part won't be sent up to the server.

If you want to capture that hash part (officially called the URL fragment), you can only do so if the referring page is your OWN page - i.e. if you can write code on that page. If it is, just send up an AJAX request to your statistics web service that captures referrers, and send the entire URL up (javascript does have access to that part of the URL).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top