FeedBurner CFC
Monday, August 27th, 2007I’ve been using FeedBurner for quite sometime now to host my RSS feeds, and when they bought Blogbeat, I was even happier since Blogbeat was a great blog-stats tool.
Now I get both feed and general item stats all from one source. FeedBurner has an API to retrieve information about your stats so I decided to wrap up some of the API into a nice little CFC. FeedBurner.cfc supports getting both general feed data as well as item data. For example:
<cfset fb = createObject("component", "feedburner")>
<cfdump var="#fb.getFeedData('RaymondCamdensColdFusionBlog')#" label="No date, will be yesterday">
This will retrieve the most current stats from the API, which will be yesterday. To get a week of data:
<cfset date = dateAdd("d", -8, now())>
<cfset last7 = fb.getFeedData(uri='RaymondCamdensColdFusionBlog',
dateBegin=date)>
<cfdump var="#last7#" label="7 Days of Info">
And finally last month:
<cfset date = dateAdd("m", -1, now())>
<cfset dateBegin = createDate(year(date), month(date), 1)>
<cfset dateEnd = createDate(year(date), month(date), daysInMonth(date))>
<cfset lastm = fb.getFeedData(uri='RaymondCamdensColdFusionBlog',
dateBegin=dateBegin,dateEnd=dateEnd)>
<cfdump var="#lastm#" label="Last Month">
This data then can easily be dumped into a chart:



