Skip to content

Include spend from entities removed during the date range - #128

Merged
kLOsk merged 1 commit into
kLOsk:mainfrom
mharnett:fix/date-ranged-reports-include-removed
Nov 8, 2026
Merged

kLOsk merged 1 commit into
kLOsk:mainfrom
mharnett:fix/date-ranged-reports-include-removed

Conversation

@mharnett

@mharnett mharnett commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #120.

  • Drops the status predicate from the date-ranged queries in get_campaign_performance (and its impression-share query), get_ad_performance, get_keyword_performance, get_audience_performance and get_pmax_performance.
  • Keyword and audience queries now select their status field.
  • New _drop_idle_removed() drops REMOVED rows with zero impressions in Python, so enabled campaigns with no impressions still show.
  • Tests (tests/test_removed_in_date_range.py) assert the generated GAQL has no status predicate, a removed row with spend is kept, removed idle rows are dropped, enabled idle rows are kept, and compact totals include removed spend.

Note: get_audience_performance keeps LIMIT 200, so idle removed rows now count toward that limit before Python drops them.

…ange

Status is today's, metrics are the period's, so a status predicate hid
spend from anything removed since. Drop the predicate from the campaign,
impression-share, ad, keyword, audience and PMax campaign queries and drop
REMOVED rows with zero impressions in Python instead (GAQL has no OR, and
impressions > 0 alone would hide enabled campaigns with no impressions).

Fixes kLOsk#120

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@kLOsk
kLOsk merged commit 651a592 into kLOsk:main Nov 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

get_campaign_performance totals leave out spend from campaigns removed during the date range

2 participants