gads_get_change_history
Google Ads read low risk
Part of the Performance Diagnosis Agent.
What it does
Retrieve the recent change log for an account from the change_event resource - who changed what, when. Returns change_date_time, user_email, client_type (e.g. GOOGLE_ADS_WEB_CLIENT, GOOGLE_ADS_API), change_resource_type (CAMPAIGN, AD_GROUP, AD_GROUP_AD, CAMPAIGN_BUDGET, etc.), resource_change_operation (CREATE/UPDATE/REMOVE), changed_fields (FieldMask of what changed), and old_resource/new_resource snapshots, plus the parent campaign/ad_group. HARD API CONSTRAINTS (verified against official docs): change_event REQUIRES a WHERE filter on change_event.change_date_time within the past 30 days, and a LIMIT clause capped at 10,000 rows - both are mandatory or the query is rejected. Changes can take up to ~3 minutes to appear. Rows come newest first: to page past the row cap, re-call with end_date set to the last (oldest) row's change_date_time, which repeats that row (no page token exists). For a more complete (but less detailed) view, change_status is the alternative resource. Primary use: anomaly root-cause - correlate a spend/conversion shift with the edits that preceded it. GOOGLE-SIDE FAILURES: when Google fails the field-level details of a window (HTTP 500 INTERNAL on changed_fields / old_resource / new_resource, seen on every window that holds a campaign start-date change made through the API), the tool retries the same window without changed_fields and payloads and returns those rows with a warning saying the field details are missing; if Google fails that too, its error comes back as a Google-side one (e.g. platform_unavailable, retryable), never as a Scalix error. Google 5xx / INTERNAL failures on any read are platform_unavailable (retryable) and rate limits rate_limited. Returns {success, data:[change rows], count, warnings}; a warning says when the row cap was hit and names this tool's filters (resource_types, start_date, end_date).
When to use it
When the user asks what changed in the account, who changed it, and when — the change history / audit trail. Lean rows by default; include_payloads=true for full before/after snapshots.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
customer_id | string | yes | Account whose change history to read, 10 digits, dashes stripped. Must be a client (non-manager) account. |
start_date | string | yes | Inclusive lower bound for change_event.change_date_time, 'YYYY-MM-DD' (or full 'YYYY-MM-DD HH:MM:SS'). MUST be within the last 30 days - earlier dates are rejected by the API. Normalize/validate before sending. |
end_date | string | no | Inclusive upper bound: 'YYYY-MM-DD' (the whole day) or a full 'YYYY-MM-DD HH:MM:SS' timestamp, used to page past the row cap. Defaults to now. The span (start..end) must stay inside the rolling 30-day window. |
resource_types | string | no | Optional comma-separated filter on change_event.change_resource_type (one string, not a list), e.g. 'CAMPAIGN,CAMPAIGN_BUDGET,AD_GROUP_AD'; upper-cased. Narrows the result and helps stay under the 10,000-row cap. |
include_payloads | boolean | no | When true, each event also carries the full old_resource/new_resource snapshots (large). Default false: events carry changed_fields (the exact field names) plus who/when/what — enough for summarising changes without the payload bulk. |
limit | integer | no | Row cap, default and maximum 10,000 (API hard limit). Values >10,000 are clamped to 10,000, and a warning says so. |
manager_id | string | no | Manager (MCC) login-customer-id, dashes stripped, only when reaching the target through a manager. |
Safeguards
Policy
Read-only audit data under the adwords scope. change_event exposes user_email of the editor - treat as personal/sensitive data: surface it for legitimate audit/root-cause only, never log it externally or use it for enrichment or cross-account profiling. Bound to the account's tenant context and Postgres RLS; do not retain beyond the request.
Reminder
user_email in change rows is personal data - show for audit, never store/enrich; match the UI Change History; don't retain beyond this request. PRESENTATION: summarise counts by change type and by user, call out high-impact changes (budget/bidding/status) and anomalies (rapid rename-and-revert), and only expand old/new payloads on request (include_payloads=true).
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
INVALID_ARGUMENT | Date filter missing/outside the 30-day window, LIMIT missing or >10,000, or an invalid change_resource_type - change_event mandates a change_date_time WHERE filter within 30 days and a LIMIT<=10000 (ChangeEventError / QueryError). | Auto-inject/clamp the date window to the last 30 days and LIMIT to 10,000; if the requested start_date is older than 30 days, return a clear message that change_event history beyond 30 days is unavailable (direct to the Change History UI). Do not guess data. | no |
CUSTOMER_NOT_FOUND | The customer_id does not exist or is unreachable with these credentials. | Verify via accessible-customers/hierarchy; refresh token or prompt re-auth if previously reachable. | no |
TOKEN_REVOKED | OAuth token expired/invalid/revoked (UNAUTHENTICATED / OAUTH_TOKEN_REVOKED). | Refresh once and retry; else prompt re-authorization (needs_reauth). | yes |
PERMISSION_DENIED | AuthorizationError.USER_PERMISSION_DENIED - user lacks access to this account's change history. | Confirm access; do not retry with another account. | no |
MANAGER_ACCOUNT_NOT_QUERYABLE | change_event is not queryable on a manager (MCC) account; only client accounts expose change history. | Use gads_get_account_hierarchy to find the client account, then re-run with that customer_id and manager_id. | no |
RESOURCE_EXHAUSTED | Daily-operations quota exceeded (QuotaError, HTTP 429). | If daily cap, stop until reset; else backoff 5/10/20s (cap 60s) honoring retryDelay, then retry. | yes |
RESOURCE_TEMPORARILY_EXHAUSTED | Per-second QPS rate limit hit (HTTP 429). | Backoff 5/10/20s (cap 60s), then retry; throttle concurrency. | yes |
PLATFORM_UNAVAILABLE | Google internal/transient error (HTTP 5xx). | Retry with backoff; report transient outage if persistent. | yes |
Edge cases
- No changes in window -> success:true, count:0, data:[] (a quiet account is valid, not an error).
- More changes match than the limit (at most 10,000) -> a warning says the result was capped; rows are newest first, so continue with end_date = the last returned change_date_time (cursor-by-timestamp), since change_event has no page token.
- Recently-made edits (<~3 min old) may not appear yet -> note the propagation delay rather than asserting nothing changed.
- start_date older than 30 days -> rejected by API; clamp to 30-day floor and warn that older history lives only in the Change History UI / change_status.
- changed_fields is a FieldMask -> only the listed paths in old_resource/new_resource are meaningful; don't infer untouched fields changed.
- change_event omits some changes (not all account changes generate events) -> if completeness matters, advise the change_status resource as a fallback.
- Manager/MCC customer_id -> the query runs as given (no pre-check); for a client's changes pass the client's customer_id, with manager_id when reached through the manager.
- Expired token -> refresh once and retry before surfacing needs_reauth.
- Criterion resources (CAMPAIGN_CRITERION / AD_GROUP_CRITERION) return empty changed_fields — Google does not populate field-level diffs for them (criteria mutate as remove+create); a runtime warning labels this so empty is never read as no-change.