Welcome to WebmasterWorld Guest from

Forum Moderators: DixonJones & mademetop

Message Too Old, No Replies

Find the referrer to the site

To find the main referrer through which one has reached the site



3:20 pm on Sep 6, 2004 (gmt 0)

10+ Year Member


Good day!

I have a website with few pages and a contact form (php form). My site is now ranking in search engines and I'm also using paid advertising campaigns.

When I receive an enquiry through the contact form I want the main referrer through which a visitor has arrived to my home page.

I used the variable 'HTTP_REFERER', just to find that I am getting my home page as 'HTTP_REFERER' through which the visitors click "Contact Us" link and arrive at the contact form page.

I want to know how they've arrived on my home page.

Please let me know.

With warm regards


11:42 pm on Sep 6, 2004 (gmt 0)

10+ Year Member

You can use a cookie to do that.


4:36 am on Sep 7, 2004 (gmt 0)

10+ Year Member

Thank you for your reply, but all my pages are static (.html pages).. and I am not sure if I can use cookies..

I am sorry I was not clear in my first message (post).. All my web pages are static.

So, is there a way I can track the referrer?

Please let me know.
With warm regards


3:27 pm on Sep 7, 2004 (gmt 0)

10+ Year Member


If you don't have access to the server to enable and record session ID's that would enable you to track a user through the site, then tracking from page to page is difficult.

The easiest way that I can suggest would be to add some Javascript code (that will not work for a small handful of your sites visitors, but without going to server side scripting - php/asp/perl/etc - your options are limited). The code could add the users referrer to the links on your page, so you could see the referrer as it is passed from page to page. If your site had lots of pages, you should only add this referrer if the referrer isn't on your site.

So, internally, the links would look like (simplified Javascript for illustration purposes):

document.write( "<a href=\"sompage.html?ref=" );
document.write( document.referrer );
document.write( "\">" );

Good Luck!



2:30 pm on Sep 8, 2004 (gmt 0)

Set a cookie with the referer string as soon as they arrive on your site (this means adding JavaScript to the top of EVERY page). Again using JavaScript, add a hidden field to your form containing the referer string from the cookie.

Suggestion: try the JavaScript forum ;)


4:56 pm on Sep 8, 2004 (gmt 0)

10+ Year Member

Hello Rajiv,

Let me see if I understand you correctly: basically, you have a contact form on your site, and given that you're doing some PPC campaigns, you'd like to know what terms, etc, brought traffic to that specific contact form. Is that correct?

If so, take a look at ConversionRuler. I use it to track conversion rates, etc, for a client who runs PPC campaigns. It's very friendly, easy to get it up and running, and doesn't cost you "an arm and a leg". I've been using it for sometime and am able to see which keyterms from my client's several campaigns are bringing the most inquiries (through the contact form).

Hope this helps!



[edited by: DaveAtIFG at 5:45 am (utc) on Sep. 11, 2004]


1:28 pm on Sep 10, 2004 (gmt 0)

WebmasterWorld Senior Member essex_boy is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Try Hitslink pure gold seems pricey but its not.

[edited by: DaveAtIFG at 5:46 am (utc) on Sep. 11, 2004]


8:19 pm on Sep 10, 2004 (gmt 0)

10+ Year Member

If you can change the PHP script add something like this
on your form on your contact page:

<script TYPE="text/javascript">
document.write("<input type=\"hidden\" name=\"REFERRER\" value=\""+document.referrer+"\">");

Then let the PHP script check for the 'REFERRER' value.



2:20 am on Sep 11, 2004 (gmt 0)

10+ Year Member

Hello Rajiv,

Check this out - clicktracks

[edited by: DaveAtIFG at 5:47 am (utc) on Sep. 11, 2004]
[edit reason] Please, no more unlinked URLs! :) [/edit]


Featured Threads

Hot Threads This Week

Hot Threads This Month