Page 1 of 1

PHP what page directed users to mine?

Posted: Wed Dec 01, 2010 2:04 pm
by Shepp001
Hi all,,

Does anyone know any code that will allow me to tell what page/site/search engine brought users to my page.

So for example if someone typed a keyword into google... and clicked onto my website.. how would i tell : a.) that is was from google.. and b.)What the keyword(s) were

Or... if someone clicked on a link on a different website, to mine, how would i be able to tell what site they came from.?

Is this possible or not? :? if so any help would be appreciated :D

Thankss

- Luke

Re: PHP what page directed users to mine?

Posted: Wed Dec 01, 2010 2:57 pm
by curlybracket
http://www.google.com/analytics/

It's free and gives huge set of statistics of every kind.

Re: PHP what page directed users to mine?

Posted: Tue Dec 07, 2010 12:05 am
by matt1234
You could setup a table in a database that records $_SERVER['HTTP_REFERER'] which will show you the URL of the page visited just prior to your's.
Try doing

Code: Select all

echo $_SERVER['HTTP_REFERER'];
to see what you will see. And if you do it that way, you'll be able to pick out what the person typed into google based on the URL

Re: PHP what page directed users to mine?

Posted: Tue Dec 07, 2010 2:23 pm
by social_experiment
From the PHP manual : 'HTTP_REFERER' : 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.