Improving RSS stats
Duo Consulting has just launched the redeisgned site and we have integrated Raymond Camden's BlogCFC with the site (Ray: Goodies to follow as a thank you). The first question that came up post launch is how do we know how many unique RSS subscribers we have and how do we know if they clicked on a link?
Good question. Knowing that web stats are usually voodoo at best
and grossly misunderstood at worst, I have adapted BlogCFC in the
following way to be able to get the following information:
1. How many unique subscribers do we have?
2. How long has each subscriber been receiving the feed?
3. How many times does the average subscriber click through to the site from a post?
The answers to these questions are really good metrics for measuring
the impact of your RSS feed on traffic but also a good way to judge the
mood of your readership about the topics you cover.
Okay so how to modify the blog you ask? The strategy is to add a
unique key for each visitor to the website and what better than the
datetime stamp right down to the millisecond? This is only flawed
if you care that there is the tiny chance that two people sign up at
exactly the same time. The next step is to detect that unique key when
a request for the rss feed comes in and if present, append all the
links in the RSS feed with the same key. You now have a threaded
experience where you can observe trends in your stats by querying your
weblogs and some stats packages (livestats, webtrends) will allow you
to create custom reports to monitor these things.
The Code
First edit the includes/pods/rss.cfm file as follows. Replace the
current rss href links with this snippet:
<cfset request.uk = dateformat(now(),'yyddmm')&timeformat(now(),'HHmmssl')>
</cfif>
<a href="rss.cfm?mode=short&uk=#request.uk#">
#application.resourceBundle.getResource("shortmode")#
</a> /
<a href="rss.cfm?mode=full&uk=#request.uk#">
#application.resourceBundle.getResource("fullmode")#
</a><br />
<cfif structKeyExists(arguments.params,"uk")>
<cfset urlAppender = "&uk=" & arguments.params.uk>
</cfif>
<items>
<rdf:Seq>
<cfloop query="articles">
<rdf:li rdf:resource="#instance.blogURL#?#xmlFormat("#instance.blogItemURLPrefix##id#")##urlAppender#" />
</cfloop>
</rdf:Seq>
</items>
</channel>
</cfoutput>
</cfsavecontent>
<cfsavecontent variable="items">
<cfloop query="articles">
<cfset dateStr = dateFormat(posted,"yyyy-mm-dd")>
<cfset dateStr = dateStr & "T" & timeFormat(posted,"HH:mm:ss") & "-" & numberFormat(z.utcHourOffset,"00") & ":00">
<cfoutput>
<item rdf:about="#instance.blogURL#?#xmlFormat("#instance.blogItemURLPrefix##id#")##urlAppender#">
<title>#xmlFormat(title)#</title>
<description>
<cfif arguments.mode is "short" and len(body) gte arguments.excerpt> #xmlFormat(left(body,arguments.excerpt))#...
<cfelse>#xmlFormat(body)#
</cfif><cfif len(morebody)> [More]</cfif>
</description>
<link>#instance.blogURL#?#xmlFormat("#instance.blogItemURLPrefix##id#")##urlAppender#</link>
<dc:date>#dateStr#</dc:date>
<dc:subject>#categoryNames#</dc:subject>
</item>
...
<cfset params.uk = url.uk>
</cfif>