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

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.

Related Posts with Thumbnails

20 Comments

  1. Posted July 5, 2010 at 4:53 pm | Permalink

    Feedburner starts to get crap.

    On my main blog I do post daily and the number looks normal :)

    In my other blog I don’t show the feed readers yet :P

    Regards

    • Posted July 5, 2010 at 5:15 pm | Permalink

      Yeah, the count looks normal if you post everyday. Otherwise you’ll notice big differences.

  2. Posted July 5, 2010 at 7:32 pm | Permalink

    Awesome! I was waiting for something like this.. I’m a big fan of Feedburner counts, but things have gotten so bad during the last month or two that I had to remove the number from my pages. This looks like a great solution for keeping things sane. Looking forward to trying it immediately – Thank you! :)

    • Posted July 5, 2010 at 7:44 pm | Permalink

      Hi Jeff, I’m glad you like it! I’m a fan of FB counts as well, and this solution (I’m using it here on CWB) is doing well for now.

  3. Posted July 5, 2010 at 8:37 pm | Permalink

    I knew about Feedburner counts going insane lately, but I had no idea it was because it was actually outputting the number of readers from the other day. Great stuff!

  4. Posted July 6, 2010 at 4:42 am | Permalink

    Thanks for the link! I love your idea of rounding the number to full hundreds! I think I’ll implement that on my blog too.

    Have a great week!

  5. Posted July 6, 2010 at 10:48 am | Permalink

    Hi Jb,

    great post… but to my mind, FeedBurner is too much annoying, that’s why I decided to delete the counter in the new version of Protuts.net. :)

  6. Posted July 6, 2010 at 12:16 pm | Permalink

    Hi Jb,

    I’v got a problem with the feedburner script. It doesn’t work : “Node no longer exists”

    The wrong line is “foreach($xml->feed->children() as $circ)”

    How can it be fixed ?

    Thanks for your help.

    Regards,

    • Posted July 6, 2010 at 12:49 pm | Permalink

      Tested it again on a local server and everything works good. What’s your feedburner id?

  7. Posted July 6, 2010 at 1:03 pm | Permalink

    Sorry, i was mistaken.

    I just forgot one letter on my feeburner id…

  8. Posted July 7, 2010 at 11:45 am | Permalink

    hey jean,
    thanks for posting such technical post up.
    apparently i am not much for a technie myself and i am sure your post will proof to be very worthwhile for me..
    i have just only started with feedburner fo my new blog of course and yes i have heard many experienced blogger just like you posting up how feedburner has apparently become.
    thanks for a good headstart thou.
    i’ll see what i can do about it and hopefully at best tweak and manage it as i go along.
    cheers
    have a nice day

  9. Posted July 7, 2010 at 5:49 pm | Permalink

    Hi jean, thanks for this great information and the code..I have one query though…Is there similar method for twitter as well?

    • Posted July 7, 2010 at 6:18 pm | Permalink

      Not exactly, but you could calculate your average followers as well. Maybe this post would be a good start?

      • Posted July 10, 2010 at 11:38 pm | Permalink

        Thanks for this piece of code..I have become a regular reader of Phpsnippets as well..see now I am subscribed to all of your blogs… :)

  10. Posted July 8, 2010 at 10:54 am | Permalink

    Your method is pretty good but it doesn’t have a cache system. Look here for the improved solution: http://www.wptuts.ro/2010/07/afisare-abonati-feed-folosind-feedburner-api/ (translate from romanian to english) :)

  11. Posted July 16, 2010 at 12:00 am | Permalink

    Sometimes is really strange to see that a blog has 12k reader and then 9k readers next day, so I’m also thinking about applying this to my blog’s counter.

  12. Posted July 20, 2010 at 5:36 am | Permalink

    That is a great tip, very useful. Thanks a lot for sharing that one. I’ll have to work that into my next design revs.

  13. Posted July 30, 2010 at 5:32 pm | Permalink

    Jean, great solution … my feed subscription has reached a good enough number that I want to display it (as some social proof) and your solution will make it possible so the counts do not fluctuate too much on a day to day basis.

    I am sure the feedburner awareness API can handle many requests, but perhaps also implementing a caching solution … even if the function simply writes to a TXT file and refreshes every other day.

    Again, just what I was looking for!

  14. Posted August 18, 2010 at 10:18 am | Permalink

    Awesome solution ! I was looking for it since a long time.

    Is it possible to do the same for emails subscribers (FeedBurner) ?

    Thanks ! :)

14 Trackbacks

  1. [...] This post was mentioned on Twitter by Jean-Baptiste Jung, Garage Bob™ and others. Garage Bob™ said: How to get a more relevant Feedburner count: Since approximately one month, the Feedburner feed count algorythm ch… http://bit.ly/bAxeUr [...]

  2. [...] explica. Cert este c? s-a g?sit un fel de solu?ie.Ieri, tipii de la CashWhoBlog au venit cu acest articol care rezolv? cât de cât problema. Mai exact, folosind codurile date de ei, nu vei mai afi?a [...]

  3. [...] How to get a more relevant Feedburner count [...]

  4. [...] g?sit o solu?ie destul de buna pe blogul CatsWhoCode, care preia num?rul de abona?i dintr-un anumit interval de zile ?i îl împarte la num?rul de [...]

  5. By Feedburner pour Wordpress on July 9, 2010 at 9:09 am

    [...] How to get a more relevant feedburner count (Catswhoblog) [...]

  6. [...] abona?ilorScriam acum câteva zile c? am reu?it s? rezolv problema de la FeedBurner cu ajutorul unui cod furnizat de b?ie?ii de la CatsWhoBlog.Codul func?iona perfect. Singura lui problem? era c? la [...]

  7. [...] g?sit o solu?ie destul de buna pe blogul CatsWhoCode, care preia num?rul de abona?i dintr-un anumit interval de zile ?i îl împarte la num?rul de [...]

  8. By 10 life-saving PHP snippets on July 19, 2010 at 4:06 pm

    [...] as $circ){ $nb += $circ['circulation']; } return round($nb/$interval); }Source: http://www.catswhoblog.com/how-to-get-a-more-relevant-feedburner-countAutomatic password creationAlthough I personally prefer leaving users to choose their password [...]

  9. By 10 life-saving PHP snippets | Programming Blog on July 20, 2010 at 1:32 pm
  10. By How to display your average feed readers on July 23, 2010 at 11:23 am

    [...] initially published on Cats Who Blog. If you enjoyed this article, please consider sharing it! tweetmeme_style = 'compact'; [...]

  11. By How to Display a FeedBurner Average on July 23, 2010 at 1:50 pm

    [...] being displayed on your blog? Why don’t you just display a weekly average? Cats Who Blog has a tutorial that shows you how you can retrieve the numbers via the FeedBurner API, average them, and display a [...]

  12. By How to Fix the FeedBurner Counter Problem on July 25, 2010 at 11:13 pm

    [...] 0 Comments645 views CatsWhoBlog presents a very interesting and effective option to display an average feed reader value using FeedBurner stats. [...]

  13. [...] an alternative or wait for Google to fix the problem.  Some blogs are using different methods to calculate the average subscriber count over a longer period, to smooth out the effect of the daily fluctuations.  Others are combining [...]

  14. By How to display your average feed readers on August 10, 2010 at 3:42 am

    [...] Code initially published on Cats Who Blog. [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting