• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Getting referrals (where user clicked to get to your site)

My client's website has a generic form on everypage and various other forms on various pages.

What he wants to find out is where the user came from (and I then post that info along with the info from the form when it's submitted).

The purpose is that he wants to know specifically where leads have come from google search results or google pay-per-click ads.

Does anybody have any pointers or ideas?


Active Member
As Harry said, Google analytics will give you you all that information and tracking ability straight out of the box, with very, if no modification.
Look at the PHP $_SERVER array.....

PHP: $_SERVER - Manual

in particular $_SERVER['HTTP_REFERER']

'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.
of course this can be spoofed, or not included .. but then so can all other techniques.


Senior Member
I think you can do similar with google? as in plain old simple google. (although that one is better ^)