Courant News: Ads

One of the big problems with a certain popular online publishing platform for college news is that the service takes a major cut of the site’s ad revenue in return for covering the hosting and infrastructure costs. Therefore, a major appeal of moving off said platform and running your own site is that you get full control of your advertising. Today’s post is about how we handle ads in Courant News.

Early on in the process, we decided that creating an advertising system was really outside of our primary area of focus, and therefore we were not going to pursue creating a system to handle and serve ads. Products like OpenX and Google Ad Manager (GAM) are quite excellent, and it would take us a long time to match their features and capabilities. Since our primary goal is to build a publishing platform, and not an advertising platform, we decided to let people use whatever ad serving service they desired, and that we would simply provide some functionality to aid in integration.

This integration is pretty simple, with some settings to put in your corresponding API/account ID, and some template tags to help integrate the ads into your templates. So far, we have only built a set of GAM template tags, since that is what we have used on the sites being built on Courant so far. However, it should be quite simple to do analogous systems for OpenX or any other ad platform.

In your templates, you first simply load the template tag library for your system.

{% load gam %}

Then where you want to put the ad in your template, you make a simple call with the name of the ad slot to render and the size of the ad.

{% gam_display_ad "TopWideBanner728x90" 728 90 %}

The tag will output the corresponding Javascript and HTML for the ad slot “TopWideBanner728x90” with the GAM API key you defined in your settings. If your server is in debug/development mode, then it will instead just render an image of the appropriate size to fill in for the ad (so as not to inflate your ad numbers).

It’s really that simple. As I said above, we plan to also have libraries for OpenX and any other ad services that people show interest in. Perhaps far down the line we would consider implementing our own ad platform, or at least integrating ad management into our admin interface, but we don’t feel that that is appropriate at this point in the project’s lifecycle.

Leave a Reply