Skip to content

Conversation

miasma13
Copy link
Contributor

@miasma13 miasma13 commented Oct 15, 2025

Task/Issue URL: https://app.asana.com/1/137249556945/project/1201048563534612/task/1210965446467206?focus=true
Tech Design URL:
CC:

Description

To use long term stats from the aggregate table we need to move from using pixel with parameters to individual pixels.
Scope of changes:

  • remove all parameters from the m.mac.daily.active.user.d pixel
  • add new separate pixels:
    • m_mac_is_default_browser_true_d
    • m_mac_is_default_browser_false_d
    • m_mac_is_added_to_dock_true_d
    • m_mac_is_added_to_dock_false_d

Testing Steps

  1. Run the app
  2. On startup:
  • Verify that old pixel is no longer including parameters
  • Verify that new pixels are being fired in set of 2
  • Changing app being default browser and/or added to dock to see if appropriate pixel variant is fired

Impact and Risks

None: Internal tooling, documentation

What could go wrong?

Broken dashboards, misreported pixels.


Internal references:

Definition of Done | Engineering Expectations | Tech Design Template


Note

Replaces parameterized dailyActiveUser pixel with standalone pixels for default browser and dock status, updating firing logic and pixel names.

  • Pixels/Telemetry:
    • Replace GeneralPixel.dailyActiveUser(isDefault:isAddedToDock:) with:
      • GeneralPixel.dailyActiveUser (no params)
      • GeneralPixel.dailyDefaultBrowser(isDefault:)
      • GeneralPixel.dailyAddedToDock(isAddedToDock:)
    • Add new pixel names:
      • m_mac_default-browser / m_mac_non-default-browser
      • m_mac_added-to-dock / m_mac_not-added-to-dock
    • Remove default_browser and dock parameters from dailyActiveUser.
  • AppDelegate:
    • Replace fireDailyActiveUserPixel() with fireDailyActiveUserPixels().
    • Fire sequence:
      • Always: dailyActiveUser (legacyDaily).
      • Default-browser status: dailyDefaultBrowser(isDefault:) (daily).
      • Dock status (SPARKLE builds): dailyAddedToDock(isAddedToDock:) (daily).

Written by Cursor Bugbot for commit a947963. This will update automatically on new commits. Configure here.

@miasma13 miasma13 requested review from ayoy and Copilot October 15, 2025 14:02
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Splits the former parameterized daily active user pixel into discrete pixels to enable leveraging long‑term aggregate stats and removes parameters from the original pixel.

  • Removes parameters (default_browser, dock) from m_mac_daily_active_user.
  • Introduces four new boolean-suffixed pixels (default browser status, dock status) but currently implemented as two dynamic-name variants without the documented _d suffix.
  • Updates AppDelegate to fire the base daily active user pixel plus the new status pixels.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
macOS/DuckDuckGo/Statistics/GeneralPixel.swift Replaced associated-value case with separate cases and added dynamic pixel name generation, removed old parameter map.
macOS/DuckDuckGo/Application/AppDelegate.swift Renamed firing method and now fires multiple pixels instead of one with parameters.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 581 to 584
return "m_mac_is_default_browser_\(isDefault ? "true" : "false")"

case .dailyIsAddedToDock(isAddedToDock: let isAddedToDock):
return "m_mac_is_added_to_dock_\(isAddedToDock ? "true" : "false")"
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated pixel names omit the documented trailing _d suffix (spec lists m_mac_is_default_browser_true_d / false_d and m_mac_is_added_to_dock_true_d / false_d). Without the suffix, downstream dashboards expecting the specified names will not receive data. Update the returned strings to append _d.

Suggested change
return "m_mac_is_default_browser_\(isDefault ? "true" : "false")"
case .dailyIsAddedToDock(isAddedToDock: let isAddedToDock):
return "m_mac_is_added_to_dock_\(isAddedToDock ? "true" : "false")"
return "m_mac_is_default_browser_\(isDefault ? "true" : "false")_d"
case .dailyIsAddedToDock(isAddedToDock: let isAddedToDock):
return "m_mac_is_added_to_dock_\(isAddedToDock ? "true" : "false")_d"

Copilot uses AI. Check for mistakes.

Comment on lines 1102 to 1108
#if SPARKLE
PixelKit.fire(NonStandardEvent(GeneralPixel.dailyActiveUser(isDefault: DefaultBrowserPreferences().isDefault, isAddedToDock: DockCustomizer().isAddedToDock)), frequency: .legacyDaily)
PixelKit.fire(NonStandardEvent(GeneralPixel.dailyActiveUser), frequency: .legacyDaily)
PixelKit.fire(NonStandardEvent(GeneralPixel.dailyIsDefaultBrowser(isDefault: DefaultBrowserPreferences().isDefault)), frequency: .legacyDaily)
PixelKit.fire(NonStandardEvent(GeneralPixel.dailyIsAddedToDock(isAddedToDock: DockCustomizer().isAddedToDock)), frequency: .legacyDaily)
#else
PixelKit.fire(NonStandardEvent(GeneralPixel.dailyActiveUser(isDefault: DefaultBrowserPreferences().isDefault, isAddedToDock: nil)), frequency: .legacyDaily)
PixelKit.fire(NonStandardEvent(GeneralPixel.dailyActiveUser), frequency: .legacyDaily)
PixelKit.fire(NonStandardEvent(GeneralPixel.dailyIsDefaultBrowser(isDefault: DefaultBrowserPreferences().isDefault)), frequency: .legacyDaily)
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DefaultBrowserPreferences() is instantiated twice (lines 1104 and 1108) and DockCustomizer() once; extracting these to local lets avoids redundant construction and improves readability. Example: let isDefault = DefaultBrowserPreferences().isDefault; reuse across branches (guard with #if if needed).

Copilot uses AI. Check for mistakes.

return "m_mac_\(isDefault ? "default" : "non-default")-browser"

case .dailyAddedToDock(isAddedToDock: let isAddedToDock):
return "m_mac_\(isAddedToDock ? "added" : "not-added")-to-dock"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Pixel Naming Mismatch Causes Analytics Issues

The pixel names for daily default browser and added-to-dock events don't align with the PR specification. The code generates names like m_mac_default-browser and m_mac_added-to-dock, but the spec expects m_mac_is_default_browser_true_d and m_mac_is_added_to_dock_true_d (and their false counterparts). This mismatch could affect downstream analytics.

Fix in Cursor Fix in Web

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.

1 participant