-
Notifications
You must be signed in to change notification settings - Fork 31
macOS: cpm count internal pixel #2215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds daily tracking of autoconsent (cookie popup) management counts and a new daily pixel (intended for internal users) reporting the previous days' counts. Integrates the stats manager into the AutoconsentUserScript and AppDelegate, and adds unit tests for counting, pixel emission, and pruning stored stats.
- Introduces AutoconsentDailyStats with persistence, daily pixel emission, and cleanup.
- Wires stats manager into user script and fires pixel on app launch.
- Adds unit tests plus pixel definition entry (with issues noted below).
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
File | Description |
---|---|
macOS/UnitTests/Autoconsent/MockAutoconsentDailyStats.swift | Adds a mock stats manager for tests. |
macOS/UnitTests/Autoconsent/AutoconsentMessageProtocolTests.swift | Injects mock stats manager into existing test. |
macOS/UnitTests/Autoconsent/AutoconsentDailyStatsTest.swift | Adds test suite for incrementing, pixel params, and cleanup. |
macOS/PixelDefinitions/pixels/autoconsent.json5 | Defines new daily popup-managed count pixel (contains syntax and grammar issues). |
macOS/DuckDuckGo/Utilities/DateProvider.swift | Adds a simple DateProviding protocol (not yet leveraged in new stats type). |
macOS/DuckDuckGo/Tab/UserScripts/UserScripts.swift | Injects stats manager into AutoconsentUserScript (via global access). |
macOS/DuckDuckGo/Autoconsent/AutoconsentUserScript.swift | Records popup management via stats manager. |
macOS/DuckDuckGo/Autoconsent/AutoconsentPixels.swift | Adds new pixel case and key. |
macOS/DuckDuckGo/Autoconsent/AutoconsentDailyStats.swift | Implements stats tracking, pixel emission, and pruning (contains syntax and logic issues). |
macOS/DuckDuckGo/Application/AppDelegate.swift | Instantiates stats manager and fires daily pixel (missing internal-user gating). |
macOS/DuckDuckGo-macOS.xcodeproj/project.pbxproj | Registers new source and test files in the project. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Privacy Review task: https://app.asana.com/0/69071770703008/1211659752515639 |
Task/Issue URL: https://app.asana.com/1/137249556945/project/1204186595873227/task/1211625735257812?focus=true
Description Adds a pixel (for internal users) that it sent daily on app use with the number of pop ups managed in the past 7 days
Testing Steps
Impact and Risks
Low: Minor visual changes, small bug fixes, improvement to existing features
What could go wrong?
The pixel is sent to non internal user
-> There is a feature flag that is active only for internal user that regulates the behaviour
Quality Considerations
<!—
Focus on what matters for your changes:
—>
Notes to Reviewer
Note
Track last-7-day autoconsent popup counts and fire an internal daily pixel, integrating stats into user script and app lifecycle behind a new feature flag, with tests.
AutoconsentDailyStats
to track per-day managed popup counts (7-day window) inThrowingKeyValueStoring
and fireautoconsent_popup-managed-count
pixel daily (internal-only,.daily
).AutoconsentUserScript
(newstatsManager
param) and increment onautoconsentDone
.AppDelegate
and triggersendDailyPixelIfNeeded()
onapplicationDidBecomeActive
.FeatureFlag.cpmCountPixel
(internal-only, default off).AutoconsentPixel
withpopupManagedCount(params:)
and define pixel schema inautoconsent.json5
(paramsd0
–d6
).Utilities/DateProvider.swift
protocol/extension.AutoconsentDailyStatsTest
andMockAutoconsentDailyStats
and update existing tests for constructor changes.Written by Cursor Bugbot for commit 2e23047. This will update automatically on new commits. Configure here.