Working with Targeting
Use targeting to identify inventory to be bought or sold. For example, a line item should target specific inventory, such as ad units of a certain size and in a specific site section.
Targeting dimensions include:
- Inventory and content
- Geographic
- Technology and devices
- Custom targeting using key-value pairs
- Delivery media (also called screen type)
- Audience segments
You use targeting dimensions in these areas of inventory setup and ad trafficking:
Area | Usage |
---|---|
Line items | Set targeting criteria that OpenX considers during ad selection, so that the users most likely to be interested in an advertiser’s message actually view the ad. |
Private Marketplace deals | Set targeting criteria to define the inventory that you want to bundle into sales-friendly packages. |
Pricing Controls | Set targeting criteria to identify the inventory when setting floors for inventory in the Exchange. |
Real-time selling rules | Set targeting criteria for selling the inventory that you make available to real-time buyers through OpenX Ad Exchange. |
You can programmatically specify targeting rules for line items, forecast rules, and deals and packages by sending a JSON object to the API.
Specifying Targeting Data
To specify targeting data, in this case for a line item, open a terminal window and make a POST
API request similar to the example below to the OpenX server to specify targeting data.
curl -X POST --header "Content-Type: application/json" http://openx_server_name/ox/4.0/lineitem \
--cookie "openx3_access_token=token_string" \
--data='{
"ad_delivery":"manual",
"delivery_medium":"WEB",
"name":"Demo line item",
"status":"Pending",
"order_uid":"200-c0-f-3-76",
"start_date":"now",
"targeting":{"geographic": {
"excludes": {
"city": "122985"
},
"includes": {
"dma": "2",
"state": "3588"
}
}
"type_full":"lineitem.house",
"account_uid":"252-af-12--76"
}'
Targeting syntax and targeting sample:
Targeting syntax
{
"targeting" : {
"inter_dimension_operator" : "OR",
"DIMENSION_KEY1" : {
"ATTRIBUTE_KEY1" : {
"op" : "",
"val" : ""
},
"includes" : "",
"excludes" : ""
},
"DIMENSION_KEY2" : {
"ATTRIBUTE_KEY1" : {
"op" : "",
"val" : ""
},
"includes" : "",
"excludes" : ""
},
...
}
}
Targeting sample
"targeting": {
"inter_dimension_operator" : "OR",
"audience": {
"op": "AND",
"val": [{
"attr": null,
"op": "INTERSECTS",
"val": "1610753366"
}],
"dmp_segments": {
"op": "INTERSECTS",
"val": "krux-1,krux-2,krux-4"
},
"audience_type": {
"op": "INTERSECTS",
"val": "1,2"
}
},
"content": {
"content_topic": {
"op": "INTERSECTS",
"val": "305,306,307"
},
"content_type": {
"op": "INTERSECTS",
"val": "1,2,3"
},
"excludes": {
"adunit": "1610612798"
},
"includes": {
"account": "537237763",
"adunit": "1610747154",
"site": "1610612798,1610750644"
},
"page_url": {
"op": "AND",
"val": [{
"p": "==",
"val": "test"
}, {
"op": "==",
"val": "some"
}]
},
"referring_url": {
"op": "OR",
"val": [{
"op": "=$",
"val": "123"
}, {
"op": "=$",
"val": "456"
}]
},
"screen_location": {
"op": "NOT INTERSECTS",
"val": "2,1,3"
}
},
"custom": {
"op": "OR",
"val": [{
"attr": "a",
"op": "==",
"val": "123"
}, {
"attr": "b",
"op": "==",
"val": "234"
}, {
"attr": "b",
"op": "EQ",
"val": "1,2,3"
}]
},
"geographic": {
"circles": {
"op": ">",
"val": "[{\"rad\":\"5\",\"lon\":\"12\",\"lat\":\"12\"},{\"rad\":\"20\",\"lon\":\"13\",\"lat\":\"13\"}]"
},
"excludes": {
"city": "122985"
},
"includes": {
"dma": "2",
"state": "3588"
},
"latitude": {
"op": "IN",
"val": "1-6"
},
"longitude": {
"op": "IN",
"val": "2-7"
},
},
"technographic": {
"browser": {
"op": "NOT INTERSECTS",
"val": "23,128"
},
"connection_speed": {
"op": "NOT INTERSECTS",
"val": "3"
},
"connection_type": {
"op": "INTERSECTS",
"val": "6,3"
},
"cookies": {
"val": 1,
"op": "=="
},
"device": {
"op": "INTERSECTS"
"val": "21"
},
"device_type": {
"op": "INTERSECTS"
"val": "3,2"
},
"https": {
"val": "1",
"op": "=="
},
"isp_carrier": {
"op": "WIFI",
"val": "NO_VALUE"
},
"language": {
"op": "INTERSECTS",
"val": "en,de"
},
"os": {
"op": "INTERSECTS",
"val": "21,42"
},
"screen_resolution": {
"op": "NOT INTERSECTS",
"val": "1,11,7"
},
"page_position": {
"op": "==",
"val": "ATF"
},
"user_agent": {
"op": "AND",
"val": [{
"op": "==",
"val": "123"
}]
}
}
}
The OpenX server processes this POST
API request and returns a response output.
NOTE
For more targeting dimension information and sample code, see Targeting Dimension Reference.