The Best Way To Count Visitors/Impressions
Posted: Fri Jan 13, 2006 1:52 pm
Hi,
I'm having a few issues with keeping track of visitors and page impressions on my website. No matter how much I search, I can't find the answer to my question.
Essentially I have two PHP counter scripts, one for visitors and one for impressions. These interact with our Mysql database. So no problems there. My question is how the visitor and impressions counter should work, to give the most accurate results.
Previously I simply had my counter page included in every page with an 'include' statement. It only did this if the User Agent (obtained using PHP) was not the Googlebot, MSN bot or Yahoo spider bot. The counter script then checked for a cookie, and worked out whether they were a unique visitor or an impression. This produced results, figures of around 50,000 visitors per day and 80,000 impressions per day. However, I read that the best way to do a counter is to include in in an <img> tag at the bottom of the page. So I did this. The figures have dropped by more than half since I did this.
I set up an extra db table to track and store all the people visiting the site, their ip, their user agent etc. I then added into the counter a query that set counted='y' in the database if it counted them as a unique visitor. That is when I started to notice that some of the people who were actually visitors to the site (came from a search engine search) were not being counted. I guess that those people may have the images switched off in their browsers, or may be using text browsers.
So my question really is, have I chosen the right way to count visitors and impressions, or should I choose another way? What methods to other people employ?
Thanks
Alastair
I'm having a few issues with keeping track of visitors and page impressions on my website. No matter how much I search, I can't find the answer to my question.
Essentially I have two PHP counter scripts, one for visitors and one for impressions. These interact with our Mysql database. So no problems there. My question is how the visitor and impressions counter should work, to give the most accurate results.
Previously I simply had my counter page included in every page with an 'include' statement. It only did this if the User Agent (obtained using PHP) was not the Googlebot, MSN bot or Yahoo spider bot. The counter script then checked for a cookie, and worked out whether they were a unique visitor or an impression. This produced results, figures of around 50,000 visitors per day and 80,000 impressions per day. However, I read that the best way to do a counter is to include in in an <img> tag at the bottom of the page. So I did this. The figures have dropped by more than half since I did this.
I set up an extra db table to track and store all the people visiting the site, their ip, their user agent etc. I then added into the counter a query that set counted='y' in the database if it counted them as a unique visitor. That is when I started to notice that some of the people who were actually visitors to the site (came from a search engine search) were not being counted. I guess that those people may have the images switched off in their browsers, or may be using text browsers.
So my question really is, have I chosen the right way to count visitors and impressions, or should I choose another way? What methods to other people employ?
Thanks
Alastair