Class: campaignSchema

mongodb/models/advertiser~campaignSchema

new campaignSchema()

Campaign schema holds most targeting logic

Source:

Methods

(static) statics.getInventoryBlockStatus(branch, blocked_inventory)

Walks blocked_inventory tree setting to determine if branch is blocked.

Currently, a branch is deemed to be "blocked" based on the 'explicit' setting of its nearest ancestor (including the node itself) stored in blocked_inventory.

For example:

$ var branch = ['Outdoor','123','456','789'];
$ var blocked_inventory = [{
                             target: Outdoor,
                             explicit = false,
                             children: [{
                                 target: '123',
                                 children: null //no other children are stored
                                 explicit: true //nearest ancestor in stored branch set to true
                             }]
                        }];
$ campaignSchema.getInventoryBlockStatus(branch, blocked_inventory);
true

$ blocked_inventory = [{
                         target: Outdoor,
                         explicit = false,
                         children: [{
                             target: '123',
                             explicit: true
                             children: [{
                                   target: '456'
                                   explicit: false, //parent is set to false
                                   children: null //no other children are stored
                             }]
                         }]
                      }];
$ campaignSchema.getInventoryBlockStatus(branch, blocked_inventory);
false

$ blocked_inventory = [{
                         target: Outdoor,
                         explicit = false,
                         children: [{
                             target: '123',
                             explicit: false,
                             children: [{
                                 target: '456'
                                 explicit: false, //parent is set to false
                                 children: [{
                                     target: '789',
                                     explicit: true, // lowest level node in branch is stored w/ explicit = true
                                     children: null
                                 }]
                             }]
                         }]
                      }];
$ campaignSchema.getInventoryBlockStatus(branch, blocked_inventory);
true

NOTE This was written as a static method so that it could be easily serialized/deserialized to pass to BidAgent instances running in a primitive Node environment. As such, any modifications to this must not rely on any Node modules or libraries, only native ECMAScript functions & objects.

Parameters:
Name Type Description
branch Array

array of ids representing branch, where top level = Clique & bottom = placement Ex: ['Outdoor', '9ruhu9302jnu9nnj','83hdnddknd678dua','83uhcbdbedndb24']

blocked_inventory inventoryBlockSchema

any valid instance of inventoryBlockSchema

Source:

(static) statics.getInventoryWeight(branch, inventory_targets)

Gets weighting for node based on inventory_targets setting based on parent-child inheritance w/ child override.

!!NOTE!! This was written as a static method so that it could be easily serialized/deserialized to pass to BidAgent instances running in a primitive Node environment. As such, any modifications to this must not rely on any Node modules or libraries, only native ECMAScript functions & objects.

Parameters:
Name Type Description
branch

array of ids representing branch, where top level = Clique & bottom = placement Ex: ['Outdoor', '9ruhu9302jnu9nnj','83hdnddknd678dua','83uhcbdbedndb24']

inventory_targets

any valid instance of inventoryTargetSchema

Source: