Read a campaign's ad schedule (dayparting)
The windows a Google campaign serves in, with the bid modifier on each, plus the criterion ids Google minted for them.
An EMPTY schedule is meaningful and is not a failed lookup: Google has no
"all day" criterion, so a campaign with no ad schedule serves around the clock.
servesAroundTheClock states that explicitly.
Set includePerformance=true to also get delivery split by day of week and by hour,
which is the evidence for deciding what the schedule should be. It is one extra
Google call segmented by both dimensions at once, so the two views always agree.
Google Ads only. The response carries cachedAt and stale, set when a
quota-exhausted call falls back to the last-good copy instead of a live read.
Authorization
bearerAuth API key authentication: send your Zernio API key in the Authorization header, prefixed with Bearer.
In: header
Path Parameters
Numeric Google platform campaign id.
Query Parameters
Disambiguates the campaign id when the connection spans platforms.
Value in
- "google"
Also return delivery by day of week and by hour. Costs one extra Google call.
Trailing window for the performance split. Ignored when fromDate and toDate are both given.
1 <= value <= 9030Start of an explicit performance range (YYYY-MM-DD). Use together with toDate.
dateEnd of an explicit performance range (YYYY-MM-DD). Must be on or after fromDate.
dateResponse Body
application/json
application/json
application/json
application/json
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.adcampaigns.getCampaignAdSchedule({ path: { campaignId: 'campaign_abc123', },});console.log(data);{ "campaignId": "string", "schedule": [ { "criterionId": "string", "resourceName": "string", "dayOfWeek": "MONDAY", "startHour": 0, "startMinute": 0, "endHour": 0, "endMinute": 0, "bidModifier": 0 } ], "servesAroundTheClock": true, "cachedAt": "2019-08-24T14:15:22Z", "stale": true, "performance": { "windowDays": 0, "byDayOfWeek": [ { "dayOfWeek": "MONDAY", "impressions": 0, "clicks": 0, "cost": 0, "conversions": 0 } ], "byHour": [ { "hour": 0, "impressions": 0, "clicks": 0, "cost": 0, "conversions": 0 } ] }}Edit a Google campaign's device, location, or language targeting
Google Ads compliance row M.10: geo and language targeting set at creation must stay editable afterwards. Send at least one of `devices`, `locations`, `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. Google only; every other platform returns 501. `devices` is 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` 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). Negative (excluded) locations are left untouched by this endpoint. 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. 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. `languages` is 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" } }`. The response includes the refreshed `devices`/`locations`/`languages` state read back from Google after the edit, and 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. When the campaign has 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.
Replace a campaign's ad schedule (dayparting)
Replaces the campaign's whole ad schedule with the windows you send. This is a REPLACE, not a merge: windows you leave out stop serving. Send `schedule: []` to clear dayparting, which returns the campaign to serving around the clock. Google rules enforced here, so you get a named field instead of a criterion error: at most 6 windows per day, a window must end after it starts, windows on the same day may not overlap, `endHour` 24 is midnight and cannot carry minutes, and minutes are quarter-hours only (0, 15, 30, 45). `bidModifier` is 0.1-10.0; Google's 0 means "off" for devices only, so a window is switched off by leaving it out. Windows are half-open (Google is exclusive of the end minute), so 09:00-12:00 and 12:00-17:00 on the same day are adjacent and both valid. Google cannot edit an ad schedule in place (every AdScheduleInfo field is prohibited on update), so this removes the live criteria and creates the new ones in a single atomic mutate. The response is read back from Google and carries the new criterion ids.