How to get a more relevant Feedburner count

Since approximately one month, the Feedburner feed count algorythm changed and now displays how many people read your feeds the past day. If you publish posts on a daily basis, you shouldn’t be really annoyed by the difference. But if you post only once or twice a week, you’ll notice big differences from a day to another.

So what can you do? Let’s have a look to a really interesting solution: Displaying your feed count for an average of X days, which is more relevant in my opinion than the current Feedburner algorythm.

The problem with Feedburner

[tweet]Since many years, Feedburner has been one of the favorite tools of bloggers, especially for what they called a “chicklet”: A small image which display how many people are reading your feeds.

The chicklet quickly became a way for people and advertisers to estimate the popularity of a blog, despite the fact that the count can be quite easily hijacked.

Since 3 or 4 months, Feedburner have lots of problems, and the count looks everything but relevant, as you can see below:

After writing about those problems last week on The Blog Herald, someone told me on Twitter that he believe that Feedburner chicklet now display the number of people who have read your feeds the past day.

So, what does that mean? If you publish daily posts on your blogs, you shouldn’t notice any big differences. But if you publish, let’s say, once or twice a week, your count can be high the day after you published a post, then be a lot lower.

Displaying your average RSS readers

Althought there’s no perfect solution to this problem, a way to get a more relevant count is to use Feedburner API to get the counts of 7 days, then display the average. I have found this method which looks quite good, but is limited to WordPress. The code below will work on any PHP sites with cURL enabled.

The first thing to do is to paste the function in your source code. If you want to use the code in a WordPress blog, you should paste it in the functions.php file.

function get_average_readers($feed_id,$interval = 7){
	$today = date('Y-m-d', strtotime("now"));
	$ago = date('Y-m-d', strtotime("-".$interval." days"));
	$feed_url="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=".$feed_id."&dates=".$ago.",".$today;
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_URL, $feed_url);
	$data = curl_exec($ch);
	curl_close($ch);
	$xml = new SimpleXMLElement($data);
	$fb = $xml->feed->entry['circulation'];
	
	$nb = 0;
	foreach($xml->feed->children() as $circ){
		$nb += $circ['circulation'];
	}
	
	return round($nb/$interval);
}

Once you added the PHP function to your site, you can use it to get your blog feed average readers. Paste the following where you want to display the count, and don’t forget to replace catswhocode by your feed name on line 2.

<?php
$nb = get_average_readers('catswhocode');
echo "I have ".$nb." RSS readers";
?>

The function display an average of 7 days, but you can define the desired number of days using a second parameter:

<?php
$nb = get_average_readers('catswhocode', 30);
echo "I have ".$nb." RSS readers";
?>

Round numbers for a better display

Did you noticied that CatsWhoBlog has been redesigned? On my sidebar, I’m using my “average feed readers” function to display an estimate of my RSS readers. In order to have a better display, I have replaced the last two numbers by zeros and added a plus sign.

This way, if I have 1287 readers, you’ll see “1200+ readers” instead. If you want to do the same on your blog, it is very easy using some basic PHP:

<?php
$nb = get_average_readers('catswhocode', 30);
echo substr_replace($nb ,"00",-2).'+ readers';
?>

That’s all for today. Hope you’ll enjoy the trick! Let me know if you have any ideas to enhance it. If you’d like to help me promote this post, please Bump it.

Published on July 5th, 2010 by Jean-Baptiste Jung

Leave a Reply