/adserver system

part of the ArsDigita Community System by Philip Greenspun
Remember that the underlying rationale for the ad server is set forth in Chapter 3 of "the book".

GIF or JPEG files for ads are stored in /ads. References look like

<a href="/adserver/adhref?adv_key=pfizer">
<img src="/adserver/adimg?adv_key=pfizer">
</a>

If the ad server gets confused, it tries to always serve up something to fill the space. It looks for [ad_parameters DefaultAd adserver] and [ad_parameters DefaultTargetUrl adserver]. If it can't find those, it notifies the site administrator to define them.

The major feature of the adserver not covered by the book is that there is a notion of ad groups. For example, if there are four ads that you'd like a user to see in sequence, you can make them part of a group and then make all the pages in a section of a site reference that group. The page need only call adv_ad_from_group with the group_key as an argument and it will get back a reference to the next appropriate ad from that group.

-- this is for publishers who want to rotate ads within a group

create table adv_groups (
	group_key	varchar(30) not null primary key,
	pretty_name	varchar(50)
);

-- these will rotate in the order spec'd (ascending, e.g., 0, 1, 2...) 
-- unless rotation_order is always NULL or is the same integer
-- in which case the order will be determined by however Oracle feels like
-- giving us the rows

create table adv_group_map (
	group_key	not null references adv_groups,
	adv_key		not null references advs,
	rotation_order	integer,
	primary key (group_key,adv_key)
);

philg@mit.edu