Simple script to count how many read your blog

Ok, admit it, who likes blogging in to a vacuum. You want to know how many people are actually reading your blog.

I have created a simple Perl script that scans your blog's log file and attempts to calculate how many people read the blog and the RSS feeds.

You can download the feed reader script. I release it under GPL2.

It's a perl script, so you would go to your web server log in the shell, and type "perl feedreaders.pl logfilename" or if you like just "tail -99999 blogfilename | perl feedreaders.pl -" because you only need to scan a couple of days worth of logs to get the figures.

Here are some notes:

  • I take advantage of the fact that most blog aggregators now report how many people they are aggregating for. There is no standard but I have put in code to match the common patterns.
  • I identify common RSS feed URLs, as well as the most common "main feed" names. If you have other feeds that it doesn't pick up on, it's easy to add them to the list at the start of the program.
  • A reader has to fetch the feed or home page multiple times from the same IP to count
  • On the other hand, people who change IPs regularly will count multiple times. People behind caches may count just once all together.
  • I try to eliminate fetches from the most common non-RSS-aggregating spiders
  • Based on my experiences, Google Reader and Bloglines are the most popular aggregators, then NewsGator.
  • At least one aggregator identifies as Mozilla, custom code tags it.
  • It also counts people who fetch your non-RSS blog page multiple times as readers.
  • Programs that don't say they handle multiple users get grouped among the singles.
  • Programs with only a few fetches are not counted

I invite my 1146 main blog readers to give it a whirl. (The 53 readers of the new Battlestar blog feed won't see this notice, nor the 72 reading the comments.

Comments

Programs that don’t say they handle multiple users get grouped among the singles.

If you have a suggestion for what to do with them, that would be great. Of course it would be nice if they reported the count. If you see a count it's easy to modify the code to parse it out.

Add new comment