The great thing when you run all your RSS feeds through Feedburner is Feedburner gives you all kinds of statistics on your RSS feed. Without statistics there is no way to measure how successful your feed is so this is a great feature that Feedburner offers.

Feedburner also offers these statistics via an RSS feed of their own. We can use this RSS feed with some server-side code and ajax to give future feed subscribers a count of total current subscribers.

ASP File Code For Getting Total Feedburner Subscribers

Using a small amount of ASP we can retrieve the Feedburner RSS feed and get the total users subscribed to our RSS feed. This code could also easily be done in other languages like ASP.NET or PHP. If you have yet to migrate your Feedburner account over to a Google account, you'll want to comment out my "objXML.Load" line and use the one before it. Also, the following code should be placed in a separate file and named feedburner.asp.

function GetFeedStats(rssFile) Set objXML = Server.CreateObject("Microsoft.XMLDOM") objXML.Async = False objXML.SetProperty "ServerHTTPRequest", True objXML.ResolveExternals = false objXML.ValidateOnParse = false objXML.preserveWhiteSpace = false 'objXML.Load("http://api.feedburner.com/awareness/1.0/GetFeedData?uri="&request.QueryString("url")) objXML.Load("https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri="&request.QueryString("url")) Set objRoot = objXML.documentElement Set objItems = objRoot.getElementsByTagName("feed") For Each objItem in objItems temp = objItem.selectSingleNode("entry").getAttribute("circulation") Next Set objRoot = Nothing Set objItems = Nothing GetFeedStats = temp end function

Getting The Total Number Of Feedburner Subscribers With JQuery

Next we use JQuery to get the response stream from our ASP file. The code is placed inside of $(document).ready(function() to ensure that we don't access our #feedburner SPAN until the DOM is fully loaded. I pass the URL we are checking on via a query string to our ASP file.

Putting It All Together

<% function GetFeedStats(rssFile) Set objXML = Server.CreateObject("Microsoft.XMLDOM") objXML.Async = False objXML.SetProperty "ServerHTTPRequest", True objXML.ResolveExternals = false objXML.ValidateOnParse = false objXML.preserveWhiteSpace = false 'objXML.Load("http://api.feedburner.com/awareness/1.0/GetFeedData?uri="&request.QueryString("url")) objXML.Load("https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri="&request.QueryString("url")) Set objRoot = objXML.documentElement Set objItems = objRoot.getElementsByTagName("feed") For Each objItem in objItems temp = objItem.selectSingleNode("entry").getAttribute("circulation") Next Set objRoot = Nothing Set objItems = Nothing GetFeedStats = temp end function %> <script type="text/javascript"> $(document).ready(function(){ $.get("feedburner.asp?url=ng-tech", function(data){ $("#feedburner").text(data); }); }); </script> <span id="feedburner"></span>