Almost all of bloggers use Feedburner to manage RSS/Atom/XML blog feeds, and you may probably use its FeedCount chicklet to display how many feed readers you have for each day. Unfortunately, since Google acquired Feedburner in 2007, Feedburner has just integrated Adsense for Adsense for Feeds to allows web publishers to earn money by placing targeted Google ads in their feeds. There is no any significant improvement or new feature. It’s believed that Feedburner chicklet now displays the number of people who have read your feed the past day. So the Feedburner counter is quite unstable recent months.

CatWhoBlog had shared a solution to display average Feedburner feed readers. This method works well on any PHP site with cURL enabled but not only WordPress. Follow the steps below to display a plain text average RSS reader counter. You can see what it exact look like at my top menu bar.

1. Login to Feedburner dashboard, under Publicize, active Awareness API.

2. Paste the code into your WordPress function.php.

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);
}

3. Paste the following codes where you want to display the counter, and don’t forget to replace webmastercrunch by your feedburner id on line 2.

<?php
$nb = get_average_readers('webmastercrunch');
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('webmastercrunch', 30);
echo "I have ".$nb." RSS readers";
?>

Don’t want to show the exact average number? Okay. Using this code you can round the counter by replace the last number with zero and add a plus sign. For example, if you have 163 RSS readers, it will show 160+ readers instead.

<?php
$nb = get_average_readers('webmastercrunch', 30);
echo substr_replace($nb ,"0",-1).'+ readers';
?>

Do you like this post?

 Subscribe free via RSS, or by Email to get updates.