Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

PHP question

Status
Not open for further replies.
Joined
Apr 5, 2005
Posts
9,729
Reaction score
1,311
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?
 
Also, Google Analytics of course :)

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.
 
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.)
 
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.
 
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.
 
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.
 
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!
 
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. '
 
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. '

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.
 
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Premium Members

Latest Comments

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom