View Full Version : Building a website monitor

26 Nov 2005, 07:55 AM

We all know about websites that offer you a snippet of code and you insert it in your webpage and then you can access an account on the website where it tells you how many visitors you had in a period of time. This is easy to create.

Well, these sites offer you more - the last 10-20 whatever inbound links - and for each they tell you if the access was direct or it came from a search engine and what keywords they searched for to get your link.

I am interested how they detect the later part, the one with the search engines. How do they find out what engine and what is the querry.

Any suggestions?


26 Nov 2005, 11:24 AM
One of the feilds passed when your browser calls a web page, is the address of the refering page. You can pull the referer data into a script and parse it for information. Since sites like google include the search terms in their pages URL (in the query string) you can parse that out of the referer address.