Skip to content

fix(analytics-aggregator): increment GlobalStats.total_campaigns on first impression (#720) - #736

Open
Sendi0011 wants to merge 1 commit into
ThinkLikeAFounder:mainfrom
Sendi0011:fix/analytics-aggregator-total-campaigns-increment
Open

fix(analytics-aggregator): increment GlobalStats.total_campaigns on first impression (#720)#736
Sendi0011 wants to merge 1 commit into
ThinkLikeAFounder:mainfrom
Sendi0011:fix/analytics-aggregator-total-campaigns-increment

Conversation

@Sendi0011

Copy link
Copy Markdown
Contributor

Summary

Fixes always returning 0 by incrementing it the first time analytics are recorded for a new campaign.

Problem

was initialized to 0 in and never incremented by any of the recording functions (, , ). always returned regardless of how many campaigns had analytics data.

Fix

In , capture whether the campaign is new ( before incrementing) and increment accordingly. This is safe because is only created via , so checking reliably detects first-time campaigns without needing an extra storage key.

Changes

  • ****: Added flag in and when the flag is true.
  • ****: Updated and to assert . Added , , and .

Test Coverage

Test What it verifies
First impression for a campaign sets
3 impressions on same campaign →
3 distinct campaigns →
Multiple impressions on same campaign →
End-to-end: impressions + clicks across campaigns → correct totals

Closes #720

…irst impression for each campaign

Record a campaign in GlobalStats when its first impression is recorded,
so total_campaigns reflects the number of distinct campaigns with
analytics data instead of always returning 0.

Tracks newness by checking if total_impressions == 0 before the
increment — no extra storage key needed since CampaignAnalytics is
only created via record_impression.

Closes ThinkLikeAFounder#720
@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

@Sendi0011 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

[bug] analytics-aggregator: GlobalStats.total_campaigns never incremented — always returns 0

1 participant