Tuesday, December 4, 2007

A great PHP Hit counter

Everyone who runs a site likes to know about who is visiting it - to better cater the site to those users, and just for curiosity. Until recently I had been using a very basic PHP script to count the hits to my site. It simply incremented a number in a text file whenever the index page was loaded.

Then I found PHPCounter - it's an excellent script that takes about a minute to install (unzip, chmod a few files), but is very powerful. It breaks down the statistics chronologically, by page visited or unique visitors for example, and displays the information as a web page for you. You can even have it ignore pageviews generated by your own activity by adding 127.0.0.1 to the ignoreip.txt file.

Best of all, it's written in PHP, so I've managed to avoid the evil javascript for another day.