Domain Manage

PHP question

Discussion in 'General Board' started by Edwin, Mar 14, 2014.

Thread Status:
Not open for further replies.
  1. Edwin

    Edwin Well-Known Member Exclusive Member

    Joined:
    Apr 2005
    Posts:
    8,460
    Likes Received:
    261
    Is there an obvious way to use a bit of PHP to check whether a visitor has come to a particular domain name "directly" i.e. by typing it into their browser, rather than indirectly (from a search engine, link on another website, Twitter, email or basically any other route)

    In other words, is there some kind of variable that can be tapped/tested that will distinguish between "pure type in" visitors and all other kinds of visitor?
     
  2. Domain Forum

    Acorn Domains Elite Member

    Joined:
    1999
    Messages:
    Many
    Likes Received:
    Lots
     
  3. AssetDomains United Kingdom

    AssetDomains Well-Known Member

    Joined:
    Feb 2010
    Posts:
    2,951
    Likes Received:
    52
  4. martin-s United Kingdom

    martin-s Well-Known Member

    Joined:
    Jul 2012
    Posts:
    2,451
    Likes Received:
    83
  5. martin-s United Kingdom

    martin-s Well-Known Member

    Joined:
    Jul 2012
    Posts:
    2,451
    Likes Received:
    83
    Also, Google Analytics of course :)
     
  6. Edwin

    Edwin Well-Known Member Exclusive Member

    Joined:
    Apr 2005
    Posts:
    8,460
    Likes Received:
    261
    Yes, Google Analytics->Real-Time->Traffic Sources with some filters can tell me what I want, but I can't (or don't think I can) take that information to actually change the page that the visitor is seeing.

    I'll have a look at the suggested variable - thanks.
     
  7. martin-s United Kingdom

    martin-s Well-Known Member

    Joined:
    Jul 2012
    Posts:
    2,451
    Likes Received:
    83
    You can't use Analytics to change what people see no, but the server variables will easily do the job.

    (Note that referrer is set by the visitors browser. Some browsers may not pass it - and some javascript links such as window.open() will prevent it being passed also.)
     
  8. Blossom

    Blossom Well-Known Member

    Joined:
    Oct 2010
    Posts:
    1,395
    Likes Received:
    55
    If it's a WordPress site, there's a plugin to change at least the landing page message (not sure about full pages) depending on where the visitor has come from.
     
  9. sdsinc Iceland

    sdsinc Active Member

    Joined:
    Aug 2005
    Posts:
    494
    Likes Received:
    9
    If there is no referer, you can assume type-in but that isn't always true. The referer is set by the browser and can be faked, or missing. A good example is the bots, the referer they leave in your logs is usually a link to their home page.
     
  10. RobM

    RobM Well-Known Member Exclusive Member

    Joined:
    Mar 2012
    Posts:
    1,089
    Likes Received:
    36
    There is no way of detecting a pure typein. You can only detect when a referring site is set and when it's not. If it's not that could be a typein but there are also other ways of it not being set and coming from elsewhere.
     
  11. Edwin

    Edwin Well-Known Member Exclusive Member

    Joined:
    Apr 2005
    Posts:
    8,460
    Likes Received:
    261
    Ok, thanks. I'm not worried what bots see at all, only humans. And if I can get that "roughly right" it's probably good enough!
     
  12. RobM

    RobM Well-Known Member Exclusive Member

    Joined:
    Mar 2012
    Posts:
    1,089
    Likes Received:
    36
    the $_SERVER['HTTP_REFERER'] will return some information but, as the PHP site says, ' The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted. '
     
  13. Edwin

    Edwin Well-Known Member Exclusive Member

    Joined:
    Apr 2005
    Posts:
    8,460
    Likes Received:
    261
    I guess I can work by elimination at least i.e. if it IS set then it can't be a direct visitor. If it ISN'T set then I'm not sure.
     
Thread Status:
Not open for further replies.

Share This Page