Skip to main content
A wrapper around query_ad_metrics that runs the query twice — current period and the comparison period — and returns both row sets plus a per-metric delta and percent-change. Avoids the double-round-trip of two separate calls.

When to use

  • “How did last week compare to the week before?”
  • “Is CPA down vs last month?”
  • WoW / MoM / YoY questions.
For comparing attribution models (not periods), use query_attribution_models. For point-in-time queries, use query_ad_metrics.

Parameters

Accepts every parameter query_ad_metrics does, plus: Previous-period semantics:
  • this_* presets map to their last_* counterparts (this_weeklast_week, etc.).
  • Trailing windows (last_7_days, last_30_days, …) shift the same span backward.
  • Custom date ranges with compare_to: previous_year subtract 365 days from both bounds.

Output

pct_change is null when the previous-period value is 0 (avoids divide-by-zero).

Caveats

Attribution windows are calendar-day-based (UTC). Across DST transitions a 7-day window may span 6d 23h or 7d 1h — mention this when explaining period-over-period changes if the period crosses a DST boundary.