Targeting Overview
Targeting allows you to define which audiences will see your ads. The Ads API enforces specific targeting schemas based on the ad product type to ensure your targeting configuration is valid and will deliver as expected.
¶ Targeting Everyone
By default, targeting is set to all audiences. To explicitly target all users without any restrictions, omit the targeting field.
When updating an ad group, you can also provide an empty targeting object {} to clear existing targeting and revert to targeting all audiences.
¶ Understanding Criteria Nesting
What is nesting? Nesting means wrapping targeting options inside criteria objects. Each criteria object can have its own operator (AND or OR) and negation setting (true or false).
Why use nesting? Nesting allows you to build complex targeting logic by:
- Combining different operators - Use
ANDat one level andORat another level to create sophisticated targeting rules - Applying negation - Use
negation: trueto exclude certain audiences (e.g., target everyone EXCEPT users who meet certain criteria) - Grouping targeting options - Organize multiple targeting options together that should be evaluated as a unit
Example without nesting:
{
"targeting": {
"negation": false,
"operator": "AND",
"criteria": [
{"new_to_location": {}},
{"uber_one": {}}
]
}
}
This targets users who are new to location AND are Uber One members.
Example with nesting:
{
"targeting": {
"negation": false,
"operator": "AND",
"criteria": [
{
"criteria": {
"negation": false,
"operator": "OR",
"criteria": [
{"new_to_location": {}},
{"new_to_brand": {}}
]
}
},
{"uber_one": {}}
]
}
}
This targets users who are (new to location OR new to brand) AND are Uber One members.
¶ Schema-Based Validation
The Ads API validates targeting structure based on your ad product type. Each ad product has a specific schema that defines:
- Allowed targeting types: Which targeting options you can use (e.g., keywords, audience segments)
- Nesting depth: How many levels of criteria nesting are permitted
- Operators: Required operators (
ANDorOR) at each level - Negation rules: Whether negation is allowed at each level
- Option counts: Minimum and maximum number of targeting options at each level
If your targeting configuration doesn’t match the required schema, the API will return a validation error with details about what needs to be corrected.
¶ Ad Product-Specific Targeting Schemas
Each ad product has different targeting capabilities and requirements: