FeedBurner Site Statistics for CommunityServer
Today Nick Bradbury wrote:
The statistics packages offered by most popular blogging services are either limited or non-existent, leaving many bloggers struggling to get good information on traffic to their blog. Those of us who use FeedBurner have long had good feed-related statistics, but we’ve had to rely on other services to get information on blog traffic.
In my case, I’ve been using Google Analytics for blog stats, and while it’s a good service I’ve found it awkward to have my feed stats and blog stats in different places. So when I was offered an early look at FeedBurner’s site statistics service (announced earlier today), I jumped at the chance.
I’ve been using FeedBurner’s site stats for several days now, and overall they’ve done a great job of providing a lot of information in a very friendly way. Now in addition to seeing information about my feed subscribers, I can also see things like:
- Which searches lead people to my blog
- Which external links are bringing visitors to my blog
- Which pages are being viewed the most
- What browsers, operating systems and screen resolutions my visitors are using
In other words, I can see the sort of information you’d expect from a site statistics service, except that it’s integrated with my feed stats.
I share the same history, been using Google Analytics and FeedBurner’s Feed Stats for several month. Though Analytics is a nice service, it’s mainly targeted at marketing. Too much for me simple guy, how only wants to know if the number of his readers becomes two-digit.
However, as Nick said FeedBurner announced their site statistic service, based on the acquired Blogbeat. I set it up for my blog two hours ago, and I already like it. Though not as sophisticated as Google Analytics, its interface is much cleaner and more appropriate for my simple needs.
But how do I come into play? Well, I was promoted a CommunityServer MVP more than two month ago, and since then I never gave back anything to the community.
Till now.
In the simplest case you only have to insert one line of HTML code to the page displaying your blog posts. However, since FeedBurner Site Stats can track your entire site, I developed a more generic implementation for CommunityServer:
- You only have to change one file (at least one per blog theme)
- It distinguishes blog posts from other pages automatically
- It disables tracking if you are an owner of a particular blog
- last but not least enable site stats only if the blog uses FeedBurner Feed stats, i.e. FeedBurner is configured as the External Feed URL
Anyway, here are the instructions. For each theme you have to make following changes in LayoutTemplate.ascx:
Add these two lines right after the <%@ Register directives at the top:
<%@ Import Namespace="CommunityServer.Components" %>
<%@ Import Namespace="CommunityServer.Blogs.Components" %>
Add following block right before the closing </body> tag:
<% CSContext context = CSContext.Current; %>
<% Weblog currentBlog = Weblogs.GetWeblog(context.ApplicationKey); %>
<% if (!Globals.IsNullorEmpty(currentBlog.ExternalFeedUrl) && currentBlog.ExternalFeedUrl.StartsWith("http://feeds.feedburner.com/")) { %>
<% if (!context.IsAuthenticated || !Permissions.ValidatePermissions(currentBlog, Permission.Post, context.User)) { %>
<% string feedBurnerAccount = currentBlog.ExternalFeedUrl.Substring("http://feeds.feedburner.com/".Length); %>
<% BlogThreadQuery query = new BlogThreadQuery(); %>
<% query.PostID = context.PostID; %>
<% if (context.PostName != null) { %>
<% query.PostName = context.PostName; %>
<% } %>
<% query.IncludeCategories = false; %>
<% query.ReturnFullThread = false; %>
<% query.SectionID = currentBlog.SectionID; %>
<% PostSet postSet = WeblogPosts.GetPosts(query, true); %>
<% WeblogPost blogPost = postSet.ThreadStarter as WeblogPost; %>
<% if (blogPost != null) { %>
<script src="http://feeds.feedburner.com/~s/<%= feedBurnerAccount %>?i=<%= Globals.FullPath(BlogUrls.Instance().Post(blogPost)) %>" type="text/javascript" charset="utf-8"></script>
<% } else { %>
<script src="http://feeds.feedburner.com/~s/<%= feedBurnerAccount %>" type="text/javascript" charset="utf-8"></script>
<% } %>
<% } %>
<% } %>
That’s all.
Comments
Scott Watermasysk
Wait until you see how easy it is to implement something like this in CS 3.0. :)
Dave Burke
Thomas, This looks very promising, but I’m not sure what it does. I’m not a Feedburner or Blogbeat user. You’re saying that you can get site page load and visitor traffic reports adding your code similar to Google Analytics. Or in other words, you need to apply this mod to get the four benefits of Feedburner Nick listed in your excerpt? Sorry to be so dense. :-)
Anonymous
nice post.
Jose Lema
After upgrading my site to SP2, I was able to get this to work as it will fail with a bad cs_weblog_postset sproc that’s updated as part of the service pack.
Thanks Thomas!
Thoemmi
Yosi, you HAVE to use the external FeedBurner RSS, because my code uses that URL to determine your FeedBurner account
Yosi Taguri
Hi,
What happens if I’m using a forward service from my domain to the real RSS feed in feedburner?
yosi
Leave a Comment
Your email address will not be published. Required fields are marked *