Home DemonstrationSignUPMember Area
 
 
 
Username    
Password  
 
Lost Your Password ? Signup Free
 
       
     
 
   
   
 
     
Click Here For Demo
Signup Now Free
Free Counter in One Click
     
  Free Counters Guide
About Tracking Referers
Counting Every Single Hit
History of Web Counters
How hosted free counters work
Counter Terms
     
     
   
   
 
 

Free Counter Guide:
About tracking referers

 

It's misspelled. It's how you tell how users found your site. What is it?

It's the HTTP_REFERER header.
Why is it misspelled? The server variable http_referer was misspelled, and after the code was released and this fact was noted, it was too late to change it, simply because so much code depending on it was developed so fast.

How does it work?

When a web browser requests your home page, it sends a small packet of information called a "request", or for the pedantic, an "HTTP Request". Most important of this information is the URL that is being requested -- but almost all browsers send along additional information that may or may not be useful.

A typical request looks like this:

GET /index.html HTTP/1.1
Host: www.example.com
Accept: text/xml,application/xml,application/xhtml+xml,text/html;
q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-encoding: gzip,deflate
Accept-charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.1)
Gecko/20060111 Firefox/1.5.0.1
Connection: keep-alive
Keep-alive: 300


I copied these headers from a request made by the Firefox web browser. Most of it may appear pretty indecipherable.

If, however, I had clicked on a link to find this site, most browsers will send an additional piece of information, that looks like this:
Referer: http://www.webstat.net/signup.php


This header tells us from where the user clicked to reach the page it's requesting.

Needless to say, this is a very useful piece of information -- if you record each referer along with each request (using a hosted counter that uses javascript, or through a log analysis tool) then you can tell where most of your web traffic is coming from.

Very often you will see something like this:
Referer:
http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=webstat.net+free+counters


As you can see, the search keywords are encoded in this referer. In this example, the user looks like they searched for "webstat.net free counters". This is one way to tell what search engines and what search keywords users are using to find your site.

This is also how some devious webmasters can block people from links from certain sites they don't like.

There is another use for the referer header: blocking image linking. Sometimes careless webmasters or people in some discussion boards will copy the image url of an image file on your site and put it in an image tag for their own site or in a discussion board post. Some people find this annoying because you are bear the load for serving up the image, yet it does you or your site no benefit.

When a web browser requests an image embedded on an html page, in most cases it will set the Referer header to the page on which the image is embedded. If you control your server's configuration, you can block all requests to image files whose referer header is present and set to a site not your own.

There are several important caveats: For one, some users turn off the sending of referer headers in their browser's preferences. Though unusual, you will not be able to tell how these users found your site.

And, there is another important problem: some devious people out there have written web spiders that browse the internet at random, sending out referer headers that are always set to a site they manage. The reason? Hoping that you'll analyze all your referer headers and publish the analysis in a public place. This will create links back to these discreditable sites, thereby increasing their importance in the eyes of many search engines. This technique is known as "referer spam". To discourage this you should never publish the referers to your site in a place that search engines can find.

 

© copyright webstat.net