Update (3/28/07): source code posted here.
Update (4/3/07): I did not realize until today that Keyvan Nayyeri had already created something similar, SyndicationAds, as part of the [Community Server MVP’s Alabaster CS Module Package](http://csmvps.com/blogs/news/archive/2006/08/14/Community-Server-MVP2700s-Alabaster-CSModule-Package.aspx “Alabaster”). Shout out to Keyvan who beat me to the bunch by about 7 months.
In a post a few days ago I posed a rhetorical question as to whether I could get ads in my RSS feeds on this site by the end of the weekend. If you’ve read my posts today via RSS you’d see that I did indeed do so.
While I’d rather not commit to whether I think it is right or not to place ads in RSS feeds, I just wanted to figure out how to do it. I doubt that I will keep them in place (at least not for this site) for very long, though. I came, I saw, I conquered - it’s time to move on.
Here is a screen show showing a couple of different ads in my RSS feed.
If you go to my Feedburner RSS feed you’ll see that there are ads displayed there as well. If you subscribe to my blog you’ll see that ads show up in your reader as well. Go ahead subscribe and see what happens :)
So, how did I do it - how did I ad RSS ads to my Community Server blog? Well, there’s a short answer and a long answer to that question.
The short answer:
I did not use Feedburner ads, I did not use Pheedo (though I now have high respect for the company and the founder, Bill Flitter). I simply followed Scott Watermasysk’s example (his ShareIT module) of building a custom CS module that injected the RSS ad into the end of the post’s formatted body. For my purposes I check to make sure that it is only being done when a post is being rendered for syndication (for RSS or ATOM). I could post the code if anyone is interested, but really it is not much more than a blatant rip-off of Scott’s code.
This will work fine if you want to embed a link to just one ad (like maybe an ad for your site or your company’s/employer’s site, etc) or you have some other link that you can embed (like to an third party ad server).
**The rest of the story:
**In order to do the ad randomizing I built a little web application to do it for me, AdBlendr.com. I started talking about something similar in a previous post and then did a bit of an experiment and posted the results in another. This time around I needed a link to a page that would
To do this I simply filled an XML file with details for 10 ads: id, image url, and link url for each one. I load the ads up into memory and then built a page to serve up the details. Each request for the image and or clickthrough page passes in a random integer (for Community Server I use the post id). This integer is put through a deterministic algorithm* that will return a number between 1-10 (or whatever number of ads there are to display) so that the same integer passed in will produce the same ad and the same clickthrough every time without having to store any results or mappings anywhere. AdBlendr’s service ends up being very fast and very lightweight - in effect all it is doing is reading in a few lines of XML and storing it in memory and then doing a bunch of redirects to images and pages hosted on other sites.
(*)deterministic algorithm = fancy words for “I did some modulo arithmetic” **
(**)modulo arithmetic = fancy words for division that only considers the remainders
On the client side - i.e. when injecting an add into the CS RSS feed - I just have to add something like this at the bottom of each post (which is what the CS RSS Ad module that I wrote does for me):
where “5678” is an example of the CS post id.
The end of the story:
So this Adblendr.com thing is pretty cool - right now it is serving up random RSS ads for me and I would bet that pretty soon it will be serving up randomized ads for use elsewhere in my sites.
What am I going to do with it? Build it up and sell it as a service? Hell no. Come on, have you seen my post where I list out the ad affiliate networks that I have found? That’s a lot of competition to deal with even if there is little barrier to entry - which probably explains why there is so much competion. But if you could find a niche (like maybe ads for Community Server sites only) then you might have a good idea to run with. Anyway, that’s not my plan - it would involve building a lot of sign-up and affiliate and membership stuff, a whole lot of legal crap, a bunch of sales and marketing to sign up advertisers, etc. How about I just use it for myself and to ease my burden when implementing ads for my own sites? That sounds a lot simpler.
However, if some buddies, pals, friends and otherwise trustworthy associates wanted to join together to form a co-op then that would be pretty cool. Doing so would allow the use of an ad system like Commission Junction, taking advantage of what they already have in place. Then revenues could be dished out based on each member’s clickthrough rate as a percentage of the whole. I’m just thinking aloud so bear with me. I don’t know that this model would be much more attractive than just doing it yourself, but it would be easier. Rather than having to do all the sign-up yourself, you could just drop in a simple link wherever you wanted an ad displayed and all the registering and selecting ads would be handled for you.
Anyway, if you’re interested in the source for the CS RSS Ad module let me know and I’ll post it.