Skip to main content

Elumenotion Blog

Go Search

 
Elumenotion > Elumenotion Blog > Posts > FeedBurner Stats Pro and FeedFlare Code for a SharePoint Blog
FeedBurner Stats Pro and FeedFlare Code for a SharePoint Blog

I wrote about FeedBurner in an earlier post about how I track site usage on this site.

If you are a regular reader of this blog, you'll notice that I recently put ads on the site. I really don't expect to make any money off of them and I'll probably take them down in a few months, but I use this site as a test bed for lots of things and I figure ads and SEO in general on public facing sites using SharePoint is something people need to know about and since we do consulting and training here at eLumenotion…

Anyway, I wanted to hook up the FeedBurner Ad Network along with Google AdSense on this site. AdSense was easy, but FeedBurner was a little trickier. Hooking up FeedBurner Ad Network requires the same script needed for FeedBurner Stats Pro, which tracks individual item usage. I never got around to including the Pro code into the site because I use two other stats packages in my quest to understand the plusses and minuses of different approaches and I can get that data from one of those.

To get the full-on FeedBurner service you need a script tag that looks like this:

<script src="http://feeds.feedburner.com/~s/MyFeedName?i=http://www.mysite.com/Blog/Lists/Posts/Post.aspx?ID=POST_ID_HERE" type="text/javascript" charset="utf-8"></script>

The tricky bit is to get the data for i in the query string.

I started out trying to use the SharePoint:ListItemProperty web control I wrote about in this post and it worked alright by passing the ID property to the control, but then I tried to update the Categories.aspx page using SharePoint Designer.

I right-clicked the ListViewWebPart and chose Convert to XSLT Data View and the conversion worked perfectly, except that the page no longer worked. No posts. Nada, just "There are no posts for this category". So… back to the drawing board. (Fortunately?), the convert to XSLT data view works seldom enough that I've gotten fairly proficient at modifying the ListView's XML by hand.

I wanted the ad to appear directly above the footer links.

The unencoded script tag looks like this:

<script src="http://feeds.feedburner.com/~s/ MyFeedName?i={$HttpVDir}/Lists/Posts/Post.aspx?ID={@ID}" type="text/javascript" charset="utf-8"></script>

The encoded script tag I need to embed looks like this:

&lt;HTML&gt;&lt;![CDATA[&lt;script src=&quot;http://feeds.feedburner.com/~s/ MyFeedName?i={$HttpVDir}/Lists/Posts/Post.aspx?ID={@ID}&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt;]]&gt;&lt;/HTML&gt;

If you spend a little time looking at the list view XML, this makes sense. It's just some HTML encoded markup containing a CDATA section that gets rendered by the web part.

I needed to insert this in default.aspx, post.aspx, and category.xml using SharePoint Designer into the list view for the post body immediately before the post footer DIV.

Locate &lt;HTML&gt;&lt;![CDATA[&lt;div class=&quot;ms-PostFooter&quot;&gt;]]&gt;&lt;/HTML&gt; and paste the code for your site immediately before the first &lt;.

This portion of the XML is in the middle of the web part, so be careful to paste it into the right spot. You might also want to create a backup beforehand. ;)

Good luck!

Comments

There are no comments yet for this post.
Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Your Name *


Attachments
Follow me on twitter!
  Archive
  Archive (Calendar)
  Skinner Created Themes
  New Skinner Download
  New Skinner Tutorial

©  2009 Elumenotion, LLC  |   SharePoint Training, SharePoint Consulting and SharePoint Staffing
8075 Cavendish Place | Suwanee, Georgia 30024 | + 1 (888) 653-5021