Working with targeting

Use targeting to identify inventoryAd space available on a website or app. The basic unit of inventory for OpenX is an ad unit. to be bought or sold. For example, a line itemThe primary unit of execution for an order, which represents a specific inventory purchase and the required conditions for ad delivery. should target specific inventory, such as ad units of a certain size and in a specific site sectionA way of classifying inventory, for example into vertical segments of content.. Targeting dimensions include:

You use targeting dimensions in these areas of inventory setup and ad trafficking:

Line items

Set targeting criteriaThe rules that define how a creative should be targeted for delivery to viewers. There are several types of targeting criteria: audience targeting, custom targeting, geographic targeting, inventory and content targeting, screen type (delivery media) targeting, and technology and devices targeting. 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

When setting floors for inventory in the Exchange, set targeting criteria to identify the inventory.

Real-time selling rules

Set targeting criteria for selling the inventory that you make available to real-time buyers through OpenX Ad Exchange.


Set targeting criteria of a proposed line item to forecast how many impressions are available for booking.

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, follow the steps described below.

  1. Open a terminal window on your system and make a POST API request similar to the example below to the OpenXserver 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" \
    		"name":"Demo line item",
    		"targeting":{"geographic": {
    		"excludes": {
    			"city": "122985"
    		"includes": {
    			"dma": "2",
    			"state": "3588"

    The following shows the syntax to specify targeting data.

    Targeting syntax

            "targeting"    :    {
                    "inter_dimension_operator"    :    "OR",
                    "DIMENSION_KEY1"    :    {
                            "ATTRIBUTE_KEY1"    :    {
                                    "op"    :    "",
                                    "val"    :    ""
                            "includes"    :    "",
                            "excludes"    :    ""
                    "DIMENSION_KEY2"    :    {
                            "ATTRIBUTE_KEY1"    :    {
                                    "op"    :    "",
                                    "val"    :    ""
                            "includes"    :    "",
                            "excludes"    :    ""

    For more targeting dimension information and sample code, see Targeting reference.

  2. The OpenX server processes this POST API request and returns a response output.