gam_run_report
Run Google Ad Manager Interactive Reports to fetch delivery, revenue, fill-rate, and ad-speed rows for performance analysis, using server-side filters to narrow results.
Instructions
MODE: read-only compute. UI: Reporting → Interactive reports. (creates a HIDDEN, API-only report definition, reused across identical runs; invisible in the UI, no entity changes.) Run a Google Ad Manager Interactive Report and return the rows. Either pick a preset ('ad_unit_totals' = Ad unit × totals: total impressions + total (CPM/CPC/CPD) revenue per ad unit for the date range; 'delivery_detail' = Advertiser × order × line item × date (with ids): impressions, revenue, eCPM, clicks, CTR, viewability rate; 'ad_speed' = AD SPEED: date × ad unit (levels 2-3) with tag-load→first-ad-request and DOM-load→tag-load latency buckets; 'ad_unit_fill_rate' = Ad unit (full hierarchy path) × date: fill rate + ad requests) or supply explicit dimensions + metrics — exact enum names from gam_report_metadata (max 10 dimensions). Date range: date_range_relative (enum from gam_report_metadata kind=date_ranges, e.g. YESTERDAY, LAST_30_DAYS) OR start_date+end_date. Money metrics are returned in currency units (converted from micros exactly once; see valueNotes). Self-heals dimension/metric incompatibility by retrying with expanded compatibility. Reports run asynchronously — expect seconds to a couple of minutes. KEY-VALUES / CUSTOM FIELDS: dimensions like CUSTOM_DIMENSION__VALUE need their key id passed in the matching array — custom_dimension_key_ids, line_item_custom_field_ids, order_custom_field_ids, creative_custom_field_ids, cms_metadata_key_ids, ekv_dimension_key_ids — at index N. gam_report_metadata names which array and slot each dimension reads; gam_targeting_keys gives the id. FILTERS: where narrows by DIMENSION value and is applied BY GAM, server-side — use it to make a report small (e.g. where=[{dimension:"ORDER_ID",values:["1234567890"]}] took 5,152 rows to 2). having narrows by METRIC value but is applied CLIENT-SIDE to the rows fetched, because GAM accepts metric filters and then ignores them — so a having result is only complete when every row was fetched; the response reports havingScannedRows/havingMatchedRows and flags havingIncomplete when it was not. Narrow with where first, then use having. Clauses AND together; match_any=true ORs the where clauses. WHEN TO USE: any 'how did X perform' question against the ad server. Filter rather than pulling thousands of rows and aggregating client-side.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "gam_run_report"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| where | No | Dimension filters — which rows exist. ANDed unless match_any. | |
| having | No | Metric filters — which rows are interesting. ANDed unless match_any. | |
| preset | No | Named preset (overridable by dimensions/metrics). | |
| metrics | No | Exact Metric enum names (gam_report_metadata). | |
| end_date | No | Fixed range end, YYYY-MM-DD, inclusive. | |
| max_rows | No | Row cap (default 200). totalRowCount always reported. | |
| match_any | No | OR the filter clauses instead of ANDing them (default false). | |
| dimensions | No | Exact Dimension enum names (gam_report_metadata). | |
| start_date | No | Fixed range start, YYYY-MM-DD (with end_date). | |
| report_type | No | Report type. Default HISTORICAL (delivery/revenue). AD_SPEED = page/creative latency. Each type has its OWN compatible dimensions and metrics — a HISTORICAL metric in an AD_SPEED report is rejected. | |
| network_code | No | ||
| currency_code | No | Override the report currency (default: network currency). | |
| timeout_seconds | No | Poll timeout (default 180s). | |
| date_range_relative | No | Relative date range enum, e.g. YESTERDAY, LAST_7_DAYS, LAST_MONTH. | |
| cms_metadata_key_ids | No | Ids backing CMS_METADATA_DIMENSION_<N>_* dimensions, by index. | |
| ekv_dimension_key_ids | No | Ids backing EKV_DIMENSION_<N>_* dimensions, by index. | |
| order_custom_field_ids | No | Ids backing ORDER_CUSTOM_FIELD_<N>_* dimensions, by index. | |
| custom_dimension_key_ids | No | KEY-VALUE REPORTING: custom targeting key ids backing CUSTOM_DIMENSION_<N>_VALUE / _VALUE_ID. Index N of this array is the key that dimension reads. Keys must have reportableType CUSTOM_DIMENSION (gam_targeting_keys). For ordinary key-value reporting the KEY_VALUES_NAME dimension needs no ids. | |
| creative_custom_field_ids | No | Ids backing CREATIVE_CUSTOM_FIELD_<N>_* dimensions, by index. | |
| line_item_custom_field_ids | No | Ids backing LINE_ITEM_CUSTOM_FIELD_<N>_* dimensions, by index. |