Edit a Google campaign's device, location, excluded location, or language targeting
Changed onChanges a Google campaign's device, location, excluded location or language targeting after it was created. Google only; every other platform returns 501.
Google Ads compliance row M.10: geo and language targeting set at creation must stay editable afterwards.
Send at least one of devices, locations, excludedLocations, languages, locationTargetingType. Each provided field REPLACES that field's existing criteria on the campaign (a full set, not a delta). Fields left out of the body are untouched.
Fields
- devices: the full set of device bid modifiers. A supported device you leave out is switched off with a bid modifier of 0, since Google cannot remove a device criterion. A device the campaign's channel does not carry, and a set that switches every device off, both return 422.
- locations: see below.
- excludedLocations: see below.
- languages: an array of Google's language codes (ISO 639-1, plus variants such as zh_CN). An unknown code returns 400.
- locationTargetingType: switches who the location targeting reaches. presence (people in or regularly in the locations) or presence_or_interest (also people searching for or interested in them). Example: { "platform": "google", "targeting": { "locationTargetingType": "presence" } }.
Locations
locations accepts the same shapes as campaign creation: a bare array of ISO country codes, or an object with countries/regions/cities/zips/metros key lists (key from GET /v1/ads/targeting/search?dimension=geo).
Excluded locations are left untouched by locations. An empty location list returns 400 instead of removing every criterion: a Google campaign with no location criteria targets every country, so omit locations to leave targeting alone.
Excluded locations
excludedLocations takes the same two shapes and replaces the campaign's negative location criteria (the places it never serves in), leaving the targeted locations untouched.
- An empty list (or {}) removes every exclusion.
- Radius exclusions are not supported.
- A place cannot be both targeted and excluded: a request whose result would leave one on both sides returns 400 before anything is written.
- Moving a place from one side to the other in the same request is applied atomically.
Example: { "platform": "google", "targeting": { "excludedLocations": { "countries": ["CA"], "regions": ["21137"] } } }.
Atomic writes and response
The removes and the creates go out in ONE Google googleAds:mutate, so a failed edit leaves the campaign's previous set intact rather than a half-applied one.
The response includes the refreshed devices/locations/excludedLocations/languages state read back from Google after the edit. It also invalidates the cached copy GET on this campaign would otherwise keep serving.
Demand Gen
Google keeps a Demand Gen campaign's locations and languages on its ad groups and refuses them on the campaign.
- With one ad group, they are written there and the response carries its adGroupId (the campaign-level locations/languages read back then stay empty).
- With several ad groups, the call returns 400 naming them. Edit each one with PUT /v1/ads/{adId} targeting on an ad of that ad group.
- Campaigns migrated from Discovery that still target on the campaign keep being written there.
- devices and locationTargetingType stay campaign-level.
- excludedLocations is not available on Demand Gen yet and returns 400.
Request
- Base URLhttps://zernio.com/api
- AuthHTTP bearer
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Path parameters
Google platform campaign ID
Request body
Example request
{
"targeting": {
"locationTargetingType": "presence"
}
}Response
Targeting updated
Changes
- info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status
- info
- warning
added the new
excludedLocationsenum value to the/response property for the response status - info
added the new optional request property
/ - info
added the optional property
to the response with the status
- warning