Showing off your FeedBurner subscribers

smashing-subscribers.pngQuite a few websites have started to show of their FeedBurner subscriber count with something else than a widget. To do that, you have to be able to grab the number of subscribers through the FeedBurner API.

Now I bet you want to know how! It’s bloody easy in WordPress, just do this:

$fb = get_option('feedburnersubscribecount');
if ($fb['lastcheck'] > ( mktime() - 600 ) ) {
	$snoopy = new Snoopy;
	$result = $snoopy>fetch('http://api.feedburner.com/awareness/1.0/GetFeedData?uri=feedburnerid');
	if ($result) {
		preg_match('/circulation=\'([0-9]+)\'/',$snoopy->results, $matches);
		if ($matches[1] != 0)
			$fb['count'] = $matches[1];
		$fb['lastcheck'] = mktime();
		update_option('feedburnersubscribecount',$fb);
	}
}
echo $fb['count'].' Subscribers can\'t be wrong! Subscribe by <a href='http://yoast.com/email-blog-updates/'>email</a> or to the <a rel='nofollow' href='http://feeds.feedburner.com/joostdevalk'>RSS feed</a> now!';

Copy, paste, replace feedburnerid with your own FeedBurner ID, and you’re done!

Update: updated the code to include caching, as you might overload the FeedBurner API otherwise.

Update 2: if you get an error saying it can’t find the class Snoopy, add this above the code:

require_once(ABSPATH . 'wp-includes/class-snoopy.php');

If this doesn’t work for you, and you’re on FeedBurners new feedproxy.google.com servers, try this solution.

Tags:


Yoast.com runs on the Genesis Framework

Genesis theme frameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides you with the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Read our Genesis review or get Genesis now!

57 Responses

  1. John LessnauBy John Lessnau on 27 October, 2008

    How many feedburner subs should one have before you start showing the number to the world. 50? 100? 1000?

  2. rohinBy rohin on 27 October, 2008

    slick advice , this is definatly a tool to use while designing a header.

    Thanks man !

  3. LyndiBy Lyndi on 27 October, 2008

    Nifty little piece of advice. One does however need a few more subscribers than I have before you to show off the number of subscribers :-(

  4. Julius Kuhn-RegnierBy Julius Kuhn-Regnier on 27 October, 2008

    nice advice! i’ve recently asked myself how you could grab the feed circulation. now i know it thanks ;)

  5. Andrew MasonBy Andrew Mason on 27 October, 2008

    My WP theme uses the feedcount plugin to display the Feedburner readers. Check it out at http://www.didigetthingsdone.com.

    I think it looks much better than the standard Feedburner widgets.

  6. Anthony ShapleyBy Anthony Shapley on 27 October, 2008

    Damn Joost your on fire with all these awesome tips :)

  7. Joost de ValkBy Joost de Valk on 27 October, 2008

    Just updated the code to include caching, as you might otherwise overload the FeedBurner API :)

  8. RarstBy Rarst on 27 October, 2008

    I am using FeedCount plugin as well. My only problem is FeedBurner reporting zeroes often, I wish it displayed last valid value instead of that.

  9. Joost de ValkBy Joost de Valk on 27 October, 2008

    @Rarst: I’ll have a look at feedcount, I bet you can code that in.

  10. RarstBy Rarst on 27 October, 2008

    @Joost de Valk

    Thanks! You might code this into your snippet it gets bigger with each page reload it seems. :) Quite a few people I know are having problems with zeroes from FeedBurner. :( I thought it was fixed some time ago but now it started again.

  11. Joost de ValkBy Joost de Valk on 27 October, 2008

    @Rarst: done, coding it into the snippet was easy, just had to add the line “if ($matches[1] != 0)”.

  12. RarstBy Rarst on 27 October, 2008

    @Joost de Valk

    Thanks again! I’ve implemented your snippet at my blog. After embarassing moment of forgetting to change feed id and suddenly displaying 4k subscribers for few seconds. :) I’ve also increased update interval, FeedBurner updates once per day, no sense in bugging it often.

  13. HebdoBy Hebdo on 27 October, 2008

    “feedburnerid” is joostdevalk in your code

  14. Joost de ValkBy Joost de Valk on 27 October, 2008

    @Hebdo: thx, fixed that, that’s what you get for copy / pasting your own code ;)

  15. GuillermoBy Guillermo on 27 October, 2008

    hey Joost… Does this work for the ones that jumped to the Google version of Feedburner?

  16. Joost de ValkBy Joost de Valk on 27 October, 2008

    Not yet, I’ll have a look at that though, stay tuned for updates!

  17. sunipeykBy sunipeyk on 27 October, 2008

    sorry but i cant run the code :( , it says “cant find the snoopy class”

  18. Joost de ValkBy Joost de Valk on 27 October, 2008

    @sunipeyk: updated the post, add that require I added in the update.

  19. sunipeykBy sunipeyk on 27 October, 2008

    Thank you for quick reply :)
    it solves the error … but no number show up :(
    is it working with feedproxy.google.com uri or not?

  20. Joost de ValkBy Joost de Valk on 27 October, 2008

    Not yet, let me look at that now!

  21. Joost de ValkBy Joost de Valk on 27 October, 2008

    If anyone who use feedproxy would please try to replace the uri=feedburnerid with id= and then the number you can see in the URL of the backend of feedburner when editing your feed. If this works, please comment with an example edit link in feedburner so I can add how that works to the post!

  22. Navjot SinghBy Navjot Singh on 28 October, 2008

    I tried your method of using id= but still the code does not work with Feedproxy as of now. Thanks for trying still.

  23. TertiusBy Tertius on 29 October, 2008

    Loving the guy on the toilet. Wish I could read my feeds on the toilet. Maybe get a kindle.

    I’ll probably get something like this online when I have some numbers to show. Still working on it!

  24. PriyanBy Priyan on 30 October, 2008

    Thanks for your nice tip. Btw, could you tell me how could i do this on the New Google Feedburner ?? Bcos i have transfered all of my feeds to the New Google Feedburner at http://feedburner.google.com

    Waiting for your guide !

  25. TheAnandBy TheAnand on 1 November, 2008

    Thanks for looking into the google feedburner thingy. I gave it a shot here:

    http://api.feedburner.com/awareness/1.0/GetFeedData?uri=fbf1vnvih05nk5modg4vepgnb4

    but it does not still work. There is no official help on this either.

  26. RichardBy Richard on 2 November, 2008

    i added it to my blog and i think it works a treat!!

  27. ColinBy Colin on 2 November, 2008

    Hi, thanks for the tutorial, but I wonder where shall I put the code to? shall i put it at where i want to display the feed count? i tried to put the code inside Dreamweaver before uploading to my site but Dreamweaver recognizes it as texts instead of codes… sorry i have no experience to coding… please help me out. Thanks a lot! :D

  28. Hotels EspagneBy Hotels Espagne on 5 November, 2008

    I’ve tried them all; hopefully this piece of code will work. I’ll let you know anyway; thanks for sharing.

  29. RajuBy Raju on 6 November, 2008

    Nice tip, but there seems to be a problem with the display of subscribers count.
    Check out my site http://www.techpp.com. I am not able to see the subscriber count at all. can’t think what have I missed?

  30. Webmaster BlogBy Webmaster Blog on 6 November, 2008

    There is a problem with feedburner today also. The subscribers count is showing 0 :(

  31. aukseoBy aukseo on 9 November, 2008

    Yup, it’s not been working today, although it might be due to me have no subscribers??

  32. ridhoypBy ridhoyp on 10 November, 2008

    hmm.. how bout joomla. have your tried it :) pliz

  33. Thinkpad t60 batteryBy Thinkpad t60 battery on 11 November, 2008

    Nice code. Thanks for sharing……
    Have a try to add my feedburner into my blog Thinkpad T60. The reason that code cant work must be the feedburner showing problem. You can see all the posts while click the RSS links.

  34. RajuBy Raju on 13 November, 2008

    I am still waiting for some help. requoting again -
    ‘Nice tip, but there seems to be a problem with the display of subscribers count.
    Check out my site http://www.techpp.com. I am not able to see the subscriber count at all. can’t think what have I missed?”

  35. Sachin TendulkarBy Sachin Tendulkar on 14 November, 2008

    Thanks a lot for the info.

    I have compiled some of the methods, including yours, to do this here,
    http://www.agentwordpress.com/five-ways-to-show-your-total-feedburner-subscriber-count

    Check it out and please provide me your valuable feedback.

  36. Sajid IqbalBy Sajid Iqbal on 17 November, 2008

    Very helpful. Plugins are real headaches for such minor tasks. More plugin=More page loading time.

  37. Travel blogBy Travel blog on 18 November, 2008

    I’ve tried them all, and for the moment I’ve NOT been able to show something else that the official widget. If your piece of code works, you’ll be my new god!

    Cheers,

    Syl

  38. JohnBy John on 19 November, 2008

    Very helpful Plugin but it doesn’t work on my website :-(
    http://www.makemoneykingdom.com . Anyone with good knowledge might probably be able to help me out. I wanna put this on my website so badly. Pls help, I request
    Thanks

  39. karthikBy karthik on 13 March, 2009

    Thanx dude, I was also thinking abt it and got solution for adding the number of subscribers. Let me try it with my site. Great help. Thanx again.

  40. RobertoBy Roberto on 27 April, 2009

    Very useful I’m going to try it…

    Thanks a lot.

    Roberto

  41. GeneBy Gene on 13 July, 2009

    Where can I find the “feedburnerid” for each of my feedburner blogs?
    Thanks,
    Gene

  42. sudhiBy sudhi on 12 September, 2009

    nice. will definitely give it a try.

Trackbacks