Results 1 to 3 of 3

Thread: Find out what site a visitor cam from

  1. #1
    Join Date
    Dec 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Find out what site a visitor cam from

    Hello,

    I have seen a script somewhere that enables you to see from which site a visitor came from before he went to yours.

    For instance, if user X came from www.google.com to www.<mysitehere>.com and I had the script implemented, I could see that user X came from google.com.

    I'm very badly trying to find this script and am unsuccesful so far, so any tips or links would be wonderful!

    Thanks,
    Qopzeep

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Using a server side script the referrer can be displayed or recorded to a database, etc, but it isn't necessarily accurate-- since this is up to the browser/user, it can be faked or not sent at all. It is generally accurate, though, on average, for statistics, etc.

    In PHP, you can find this value as part of the $_SERVER global array:
    echo $_SERVER['HTTP_REFERER'];
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Dec 2007
    Location
    Essex, UK
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The document has a property document.referrer that is "the url of the link that brought the browser to the current document, if any" (David Flanagan, Javascript: the definitive guide).

    This works with the caveats mentioned by dir33 above.

    John Rostron

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •