Database Reference
In-Depth Information
This design uses the
site_id
and
zone_id
submitted with the ad request, as well as inform-
ation stored in the ad inventory collection, to make the ad targeting decisions. Later examples
will build on this, allowing more advanced ad targeting.
Schema Design
A very basic schema for storing ads available to be served consists of a single collection,
ad.zone
:
{
_id
:
ObjectId
(...),
site_id
:
'cnn'
,
zone_id
:
'banner'
,
ads
:
[
{
campaign_id
:
'mercedes:c201204_sclass_4'
,
ad_unit_id
:
'banner23a'
,
ecpm
:
250
},
{
campaign_id
:
'mercedes:c201204_sclass_4'
,
ad_unit_id
:
'banner23b'
,
ecpm
:
250
},
{
campaign_id
:
'bmw:c201204_eclass_1'
,
ad_unit_id
:
'banner12'
,
ecpm
:
200
},
... ]
}
Note that for each site-zone combination you'll be storing a list of ads, sorted by their
eCPM
values.