gads_get_device_performance
Google Ads read low risk
Part of the Bidding Agent.
What it does
Break performance down by DEVICE (segments.device: MOBILE / DESKTOP / TABLET / CONNECTED_TV / OTHER) for a campaign (or the whole account when campaign_id is omitted) over a date range — one row per campaign x device. Metrics: impressions, clicks, CTR, avg CPC, cost, conversions, conv value. Money micros->currency (/1e6). Each device row is a per-slice figure — do NOT sum device rows and present them as a campaign total. Reconciles to the UI within +/-1%. Returns {success, data:[{campaign, segments.device, metrics}], count, warnings}.
When to use it
Use to see how a campaign performs on mobile vs desktop vs tablet before setting device bid adjustments.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
customer_id | string | yes | 10-digit Google Ads customer ID (CID), dashes stripped. Server-derived tenant context + RLS. |
campaign_id | string | no | Restrict to one campaign (recommended to bound rows). |
date_range | string | yes | GAQL macro (LAST_7_DAYS/LAST_30_DAYS/THIS_MONTH/LAST_MONTH) or explicit YYYY-MM-DD,YYYY-MM-DD. ALL_TIME removes the date filter entirely; so does omitting it (all time). |
limit | integer | no | GAQL LIMIT cap; large pulls use SearchStream. |
Safeguards
Policy
Never fabricate or approximate a metric; if a figure can't be reconciled to the Google Ads UI within +/-1%, say so. Money is micros/1e6 (label the account currency); rates are ratios.
Reminder
Treat account performance data as sensitive; do not retain beyond this request.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
CUSTOMER_NOT_FOUND | Account {customer_id} not found or not linked. | Verify the CID and authorization. | no |
needs_reauth | Authorization expired or revoked. | Reconnect Google Ads in the Scalix dashboard. | no |
INVALID_ARGUMENT | Malformed date_range or filter. | Fix the argument and retry. | no |
MANAGER_ACCOUNT_METRICS_UNSUPPORTED | Manager (MCC) accounts return no metrics. | Query a child account. | no |
PERMISSION_DENIED | The authenticated user lacks access to this account. | Check account access. | no |
RESOURCE_EXHAUSTED | Rate/quota limit hit. | Back off and retry. | yes |
Edge cases
- No data -> count:0 with a note naming the date range and the filters applied (no delivery in that window, or nothing matched).
- segments.device multiplies rows (per-slice, not totals).
- Manager account -> no metrics.