targeting Object

The targeting object defines exactly who will see the ads within your ad group. An ad group can be one of keyword, contextual, behavioral or runOfSite tactics in combination with geoTargets

Supported Targeting Types


The targeting object supports the following targeting types.

Targeting TypeDescription
geoTargetsRestricts delivery to specific geographic locations. If omitted, targeting defaults to the United States.
behavioralReaches users based on previous shopping behavior, intent signals, or audience attributes.
contextualPlaces ads on pages relevant to selected product categories.
runOfSiteAllows the ad to run site-wide without behavioral, contextual, or keyword targeting constraints.
keywordsAllows ads to be shown to users searching for relevant terms. Keyword targeting is not supported for Video campaigns.

Supported JSON Schemas

Our API supports two distinct JSON schemas for defining targeting: Expression-Based (Legacy nested JSON structure) and the Flattened Structure (new).

  • The Expression-Based Structure (Legacy): The Expression-Based Structure is the legacy structure,using nested logical operators . In this structure, the root must be an and array. Negative targeting (exclusions) must be wrapped inside a not array, which itself is nested inside the root and array
  • The Flattened Structure (New): The Flattened Structure is the new flattened schema. Instead of requiring you to build complex logical trees (AND/NOT), you simply define arrays of items you want to include or exclude

You must use only one structure in a single Create or Update request payload. Mixing expression-based and flattened targeting structures in the same request is not supported.

Key Rules

  • You may define exactly one primary tactic: keywords, contextual, behavioral, or runOfSite .
  • You may optionally combine your primary tactic with geoTargets
  • Negative targeting is supported only for keywords and behavioral. In the Expression-Based Structure, use not. In the Flattened Structure, use exclude
  • Within each include or exclude array, values are evaluated using OR logic. Exclusions are then applied against the included set. For example: include (1 OR 2 OR 3) AND exclude (5 OR 6 OR 7)

Retrieving targeting in Flat Format

For supported read APIs, you can retrieve targeting details in the flattened structure by passing the following request header: x-targeting-format: FLAT

This header is used only to control the response format for supported read APIs, such as:

  • List Ad Groups
  • Entity Snapshot API - line item snapshot

Supported Values:

Header ValueDescription
FLATReturns targeting details using the flattened structure.
EXPRESSIONReturns targeting details using the expression-based structure. This is the default response format.

If the x-targeting-format header is not included, targeting is returned using the expression-based structure by default.

Create, Update, and Forecasting APIs do not require the x-targeting-format header. These APIs can accept either the expression-based structure or the flattened structure in the request payload.

Request Fields by Targeting Type


keywords

  • Keyword targeting allows ads to be shown to users searching for relevant terms.
  • Keyword targeting is not supported for Video campaigns.
FieldData TypeRequiredDescription
keywordTextstringYesSearch term to target.
matchTypestringYesKeyword match type. Supported values are BROAD and EXACT.

Notes:

  • negative keyword targeting is supported
  • excluded, or negative, keywords support only EXACT match

contextual

Contextual targeting places ads on pages relevant to selected product categories.

FieldData TypeRequiredDescription
idintegerYesContextual taxonomy node ID.
reachstringYesContextual reach tier. Supported values are tier_1, tier_2, tier_3, tier_4, tier_5, tier_6, and tier_7

Reach tier mapping:

UI reach levelAPI reach tiers
Lowtier_1, tier_2
Midtier_3, tier_4
Hightier_5, tier_6, tier_7

Notes:

  • Negative contextual targeting is not supported.
  • Do not use not or exclude for contextual targeting.

behavioral

Behavioral targeting reaches users based on previous shopping behavior, intent signals, or audience attributes.

FieldData TypeRequiredDescription
idintegerYesAudience segment ID.
audienceTypestringYesType of behavioral audience. Possible values: retailbrandpersonacustomdemographic 
attributestringYesIdentifies the specific nature of the audience Possible values depending on audienceType:
  1. For retail (category):
    • historical
    • predictive
  2. For brand:
    • historical
    • predictive
    • lapsed_buyers
  3. For persona:
    • lifestyle
    • lifestage
    • auto
    • shopping_habits
    • food_beverages
  4. For demographic
    • age
    • gender
    • household_income

Notes:

  • Negative behavioral targeting is supported.
  • Use not in the Expression-Based Structure.
  • Use exclude in the Flattened Structure

runOfSite

Run-of-site targeting allows the ad to run site-wide without a primary behavioral, contextual, or keyword targeting tactic.

FieldData TypeRequiredDescription
runOfSitebooleanYesSet to true

Notes:

  • If runOfSite is set to true, no other primary targeting type may be defined.
  • runOfSite may be combined with geoTargets if geographic restrictions are required.

geoTargets

Geo targeting restricts ad delivery to a specific geographic area.

If geoTargets is omitted, targeting defaults to the United States.

You cannot combine different geo-targeting types within a single ad group.

Supported geo targeting options:

Geo Targeting OptionRequest Field
CountryOmit geoTargets to target the entire United States.
State and CityProvide an id (integer) to target by State, City
DMAProvide an id (integer) to target by DMA.
Zip CodeProvide a zipCode (string) to target specific US Zip Codes.

Example structure:


keywords (Expression Structure)

"targeting": { "and": [ { "and": [ { "keywords": [ { "keywordText": "running shoes", "matchType": "BROAD" } ] }, { "not": [ { "keywords": [ { "keywordText": "trail sneakers", "matchType": "EXACT" } ] } ] } ] }, { "geoTargets": [{ "id": 123} ]} ]
}

keywords (Flattened Structure)


"targeting": { "keywords": { "include": [ { "matchType": "EXACT", "keywordText": "running shoes" }, ], "exclude": [ { "matchType": "EXACT", "keywordText": "trail sneakers" } ] }, "geoTargets": { "include": [ {"id": 123} ] }
} 


contextual (Expression Structure)

"targeting": { "and": [ { "contextual": [{"id": 101, "reach": "tier_1"}] }, { "geoTargets": [{"id": 123}] } ]
} 

contextual (Flattened Structure)

"targeting": { "contextual": { "include": [{"id": 101, "reach": "tier_1"}] } }, "geoTargets": { "include": [ {"id": 123} ] }
} 


behavioral (Expression Structure)

"targeting": { "and": [ { "and": [ { "behavioral": [{ "id": 200, "audienceType": "RETAIL", "attribute": "HISTORICAL" }] }, { "not": [{ "behavioral": [{ "id": 201, "audienceType": "RETAIL", "attribute": "HISTORICAL" }] }] } ] }, { "geoTargets": [{ "id": 123 }] } ]
} 

behavioral( Flattened Structure)

"targeting": { "behavioral": { "include": [{ "id": 200, "audienceType": "RETAIL", "attribute": "HISTORICAL" }], "exclude": [{ "id": 201, "audienceType": "RETAIL", "attribute": "HISTORICAL" }] } }, "geoTargets": { "include": [ {"id": 123} ] }
} 


runOfSite (Expression Structure)

"targeting": { "and": [ { "runOfSite": true }, { "geoTargets": [ { "id": 123 } ] } ]
}

runOfSite (Flattened Structure)

"targeting": { "runOfSite": true , "geoTargets": { "include": [ { "id": 123 } ] }
} 


geoTargets (Expression Structure) - using id:

{ "geoTargets": [ { "id": 123 } ] }

geoTargets (Expression Structure) - using zipCode:

{ "geoTargets": [ { "zipCode": "94001" } ] }

geoTargets (Flattened Structure) - using id:

{ "geoTargets": "include":[{ "id": 123 }]
}

geoTargets (Flattened Structure) - using zipCode:

{ "geoTargets": "include":[{ "zipCode": "94001" }]
}


List Response Metadata

When targeting is returned by the List Ad Groups API or Line item entity snapshot, the targeting object may include additional metadata fields to help developers display, audit, or map targeting values in partner systems.

These fields are returned in responses and should be treated as response metadata. Do not include response-only metadata fields in Create or Update request payloads unless the endpoint documentation explicitly allows them.

contextual response fields

FieldData typeDescription
idintegerContextual taxonomy node ID.
namestringDisplay name of the contextual targeting value.
mappingTypestringProduct taxonomy level associated with the selected contextual value.

behavioral response fields

FieldData typeDescription
idintegerAudience segment ID.
namestringDisplay name of the behavioral audience value.
audienceTypestringType of behavioral audience. Possible values: retailbrandpersonacustomdemographic 
attributestringIdentifies the specific nature of the audience Possible values depending on audienceType:
  1. For retail (category):
    • historical
    • predictive
  2. For brand:
    • historical
    • predictive
    • lapsed_buyers
  3. For persona:
    • lifestyle
    • lifestage
    • auto
    • shopping_habits
    • food_beverages
  4. For demographic
    • age
    • gender
    • household_income
mappingTypestring

Product taxonomy level associated with the selected behavioral category. Applies only if audienceType = retail

Supported mappingType values:
  • PRODUCT_CATEGORY : L1 Department
  • PRODUCT_FAMILY: L2 Category
  • PRODUCT_TYPE: L3 Sub-category

keywords response fields

FieldData typeDescription
keywordTextstringKeyword text.
matchTypestringKeyword match type. Possible values: BROAD or EXACT . (Note: Negative keywords only support exact match.)
reviewStatusstringReview status of the keyword, such as PENDING_REVIEW or APPROVED

geoTargets response fields

Returns different fields depending on the geo targeting type used.

If state, city, DMA, or country targeting is used, the response includes id, name, and locationType

FieldData typeDescription
idintegerGeo target location ID
namestringDisplay name of the geo target location
locationTypestringType of geo target location, such as COUNTRY, STATE, CITY, or DMA

If zip code targeting is used, the response includes zipCode.

FieldData typeDescription
zipCodestringZip code used for geo targeting.

Forecasting API Behavior

Forecasting APIs can accept targeting inputs using either the Expression-Based Structure or the Flattened Structure. If targeting values are provided in a forecasting request, the forecast is based on the request targeting values, not on any existing ad group targeting settings.

📘

Notes and Validation Guidance

  • Use only one targeting schema per request payload.
  • Do not mix expression-based and flattened structures in the same payload.
  • Define exactly one primary tactic: keywords, contextual, behavioral, or runOfSite.
  • Optionally combine the primary tactic with geoTargets.
  • Do not combine different geo-targeting types within a single ad group.
  • Use negative targeting only with keywords and behavioral.
  • Use not only in the Expression-Based Structure.
  • Use exclude only in the Flattened Structure.
  • Treat additional fields returned by List Ad Groups and line item snapshot, such as name, mappingType, and reviewStatus, as response metadata.



Did this page help you?