What is the best way to count website hits?

Ive been thinking hard about the best way to do this…

If I use cookies to measure hits, then I can measure the number of unique hits to my website, but a hit cannot be registered until the user navigates to a new page or refreshes the current page.

If I dont use cookies then I cant measure unique hits, only the number of page views. Unless I add a query to the URL which is not desirable because its not search engine freindly.

Is there any other ways to measure the number of hits? because I cant think of any other possible way.

thank you as always

ro0bear :smiley:

You can register unique visitor just when client requests the page first time and then set the cookie. When the user requests another page you can just compare the cookie and do not consider it unique it matches already saved cookie.

What if cookies are disabled though? Then a cookie would not be set, so the server will think that every page visit by that visitor is a different unique visit, or is there a way round that?

ro0bear :smiley:

There is no way around that. The count of unique visitors is always only an estimate.

there are many hit counters available in the market…just use hit counter to measure the number of hit s your website receives…

What if cookies are disabled though? Then a cookie would not be set, so the server will think that every page visit by that visitor is a different unique visit, or is there a way round that?

Maybe you can try using referer HTTP header - if it matches page that is on your site then it is not unique visit?

Brilliant, I really think that could work! :smiley:

Yes that seems to be working great. Encase anyone else wants to try this method, I will post back here if I come across any problems with it.

Thanks everyone :smiley:

Well I have been playing with the referer HTTP header for a while now for counting Unique hits. The main problem with this method is probably the fact that if you type the address in then the referer HTTP is blank. It only works if you are linked to the website.
I have reduced the effect of this a little using REQUEST_URI to see if the uri is empty, and using QUERY_STRING to see if the query string is empty. if they are both empty then its likely that the url has been typed in. (on the website I am testing this on, if you type the domain name in, then there is no URI, but if you go back to the home page or any other page then a URI such as index.php or about-us.php is present, so only initial visitors who have just typed in the domain name should be without a URI).

so in conclusion, the HTTP_REFERER can detect if the visiter has been linked from another page, and REQUEST_URI and QUERY_STRING can be used to detect if the user has typed in the domain name to the URL.

holes are still left if the user has bookmarked a page that is not the home page, so has a URI, or if the user types in a URI.

Any ideas on how the number of unique hits can be calulated more accurately?

I am thinking about combining this method, with a cookie method for unique hits, and then comparing the two estimates for a final accurate estimate?

ro0bear :smiley:

i am using statcounter.com, and I am very happy with it.

It does not matter how many hits you´re getting (although we´re using the term “hits” for now, it really is the wrong term to use… but read on). What matters is how many hits you are getting compared to a relative date. Why?

Of course it is important to date your hits, there is little point in saying I have had at some point 100,000 hits. For hits to be of any use, every hit should be dated. This allows you to look at how many hits you have recieved over time, and relate events that have happened to hit fluctuations, for instance you may see your hits go down during the olimpics because not as many of your target users are online, and you may see a rise in hits after putting up some posters about your website in your local town.

Unique hits are important because then you can measure how many people are visiting your website, and page hits are important because you can divide the total page hits by the unique hits to find out how many pages the average person visits, allowing you to judge how useful/interesting your site is to people.

I also record how many hits each page gets, allowing me to see which pages are the most popular, so I can get an idea of where to take the website in the future for the best result.

ro0bear :smiley: