Feedburner Alternative: Homegrown Feed Statistics for Your Blog

If, for whatever reason, you don’t want to use Feedburner to track your feed statistics, this article describes a relatively simple, “roll-your-own” alternative. Instead of redirecting your feed traffic through Feedburner, keep your original feed URLs and place the following code into a file named “feed_stats.php” (or whatever) and upload to your server:


$thedate = date('Ymd');
$thetime = date('h:i:s');
$logfile = "/path/to/stats/feed_stats.log";

$logdata = "$thedate|$thetime|$browser|$address|$my_time|\n\n";

$fp = fopen($logfile, "a");
fwrite($fp, $logdata);


Next, create a log file called “feed_stats.log” and enable write permissions via 755 or 777. After uploading the log file to a choice location on your server, edit the “$logfile” variable in your feed_stats.php script to reflect the correct relative file path.

Finally, include feed_stats.php in any feed-generating scripts used on your blog via the following line:

<?php include("path/to/feed_stats.php") ?>

For example, if you are using WordPress, you would place the previous include directive into each of the following files:

  • wp-rss2.php
  • wp-rss.php
  • wp-atom.php
  • wp-rdf.php
  • wp-commentsrss2.php

..depending on which feeds you would like to track. Different blog platforms have similar files, which should be described in the available literature. There is a ton of things you could do with this script. For example, you could modify the code with a few “if()/ifelse()” statements to write to a different log file for each of your different feed types. And so on. The point here, is that there are alternatives (albeit considerably less sophisticated) to the voraciously popular Feedburner service.