No, I'm not starting another project and I'm not starting another blog series. First I had a problem/question/idea, then I did a little research, and now I'm just doing a little prototyping to see what's feasible.
I would like to use ads from other networks in addition to Adsense on my site. I wondered what it would take to build something for my sites that would rotate ads from various ad networks rather than have to put in more ad placements to serve that purpose.
Following are my requirements starting with the most important (for now). These requirements could easily be delivered in stages:
- Some sort of local configuration that would allow rotation of ads from specified networks/affiliates. This could be via an XML config file or some local data store and build upon step 1.
- A centralized management and configuration utility allowing me to setup ads and define which ones are displayed where. This would involve setting up some kind of ad server and should still be as easy to use on the client side as step 1. Ideally this would build upon the first two steps.
- Ideally the entire system would be flexible enough to allow me to use it in any of the 3 above ways that I choose. This would be especially good for failover in case the server portion was down, overwhelmed, or otherwise not responsive.
In a comment to my initial post Leo Nelson said BanManPro was the only good .NET ad management solution that he had found in his research, but he pointed me to a PHP solution called OpenAds. I looked into OpenAds, read the history, downloaded the code (it is GPL) and poked around a bit. It has some nice features and the newer branch v2.3 (AKA Max Media Manager) looks very promising.
Additionally, I found a "simple" PHP Ad Rotator on the Idealog. The author's desires sound similar to my own.
Based on what I've seen so far I believe that I have 4 options:
- Use the OpenAds system - PHP and MySQL will run on Windows!
- Port the OpenAds system to .NET - sounds fun but I don't have time to captain an open source project at the moment.
- Build my own system - using ASP.NET of course. This would allow me to implement in stages and devote time to the project when it is available.
- Say "To heck with it" and just manually add the different ad code to my sites. But what fun is there in that?
For now my decision is to table the decision. I may look into OpenAds further if I decide I need something sooner rather than later. But as part of process leading to that decision I developed a spike to determine the feasibility of building my own .NET system. And after all that introduction we're finally getting to what this post was supposed to be about: a description of that development spike.
I felt that the most important thing to prototype was the actual rendering of the ads, the main point of the system. Along with the rendering I needed to see if I could render ads from different networks/affiliates using a single simplified interface. To do this I chose to build an ad rendering engine that makes use of a provider model to hand off the rendering details to the provider for each specific ad network. The providers each implement IAdProvider and only really have one public method: Render().
Fundamentally the engine itself is simple, it takes a set of parameters (Ad Network, Text or Image or Both, Width, Height, Background Color, Border Color, etc), based on the network type it instantiates the proper provider for it, and then tells the provider to Render.
Below are two screenshots, one showing Google Adsense ads being rendered and the other showing Amazon ads:
Ah, which brings me to the simplified interface. Because I'm choosing to deliver ads from multiple vendors I'm only implementing a subset of what each one is capable - the least common denominator. At this point I have only looked at two vendors so I haven't had to pare down each one's offerings too badly. But I imagine that as support is added for more vendors the options might have to be whittled down further. Luckily it seems that there is a set of standard ad sizes and that will end up being what this system is capable of - the standard ads (large banner ads, small banner ads, skyscrapers, 250x250 squares, etc). There are a lot of cool ad options that Amazon will do, though, that just won't fit into this. One alternative is to choose a larger set and have the providers notify which ones they will support (and/or choke on the ones they do not!). Another alternative is to keep the smaller set of standardized ads but to allow for custom ads to be defined on a one-off basis. Eventually a decision would have to be made on which way to go with that.
That's where this exercise probably ends. At some point I may decide to go through with my requirement #2, building a local configuration system that will handle the rotation of ads, but I doubt that I'll build an all-out ad server system (at least no time in the near future). If nothing else, I learned quite a bit more about ad networks and their ads and came up with a long, in not comprehensive, list of some different ad/affiliate networks that should continue to serve as a good resource. Hopefully my sharing has allowed you to learn something as well. If you have any questions feel free to comment or email me and I'll do my best to answer them.