Set Ad Group Targeting
set_ad_group_targetingSets geographic and language targeting on an AD GROUP — the only place Demand Gen keeps them.
Demand Gen campaigns reject location and language at campaign level: Google keeps both on the ad group instead (measured on a live campaign). That left a Demand Gen campaign impossible to limit geographically through Opus, so it went live on Google's default of every country and spent the budget outside the target market. This tool closes that: pass the ad group and the countries, and it writes the criteria where Google actually reads them.
locations: comma-separated names or geo IDs ('Germany' or '2276' or 'Almanya, Fransa'). negative_locations: places to exclude. languages: codes (tr, en, de) or numeric IDs. mode='add' keeps what is there and adds; mode='replace' removes the existing criteria of the dimensions you pass and writes yours in the SAME request, so the ad group is never left untargeted. confirm=false previews the resolved locations and what would be removed. Read the current state with get_campaign_targeting(ad_group_id=...).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | add | |
| confirm | No | ||
| country | No | TR | |
| languages | No | ||
| locations | No | ||
| ad_group_id | Yes | ||
| customer_id | Yes | ||
| negative_locations | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||