Database Reference
In-Depth Information
Design 3: Keyword Targeting
Where frequency capping in the previous section is an example of user profile targeting, you
may also wish to perform content targeting so that the user receives relevant ads for the partic-
ular page being viewed. The simplest example of this is targeting ads at the result of a search
query. In this case, a list of keywords is sent to the choose_ad() call along with the site_id ,
zone_id , and user_id .
Schema Design
In order to choose relevant ads, we'll need to expand the ad.zone collection to store relevant
keywords for each ad:
{
_id : ObjectId (...),
site_id : 'cnn' ,
zone_id : 'search' ,
ads : [
{ campaign_id : 'mercedes:c201204_sclass_4' ,
ad_unit_id : 'search1' ,
keywords : [ 'car' , 'luxury' , 'style' ],
ecpm : 250 },
{ campaign_id : 'mercedes:c201204_sclass_4' ,
ad_unit_id : 'search2' ,
keywords : [ 'car' , 'luxury' , 'style' ],
ecpm : 250 },
{ campaign_id : 'bmw:c201204_eclass_1' ,
ad_unit_id : 'search1' ,
keywords : [ 'car' , 'performance' ],
ecpm : 200 },
... ]
}
Operation: Choose a Group of Ads to Serve
In the approach described here, we'll choose a number of ads that match the keywords used in
the search, so the following code has been tweaked to return an iterator over ads in descending
order of preference. We've also modified the ad_iterator to take the list of keywords as a
second parameter:
Search WWH ::




Custom Search