feat(analytics): unify cross-platform tracking#90
Conversation
Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request implements a unified analytics tracking system for both Windows and macOS platforms, introducing standardized event names for page views and clicks. It also enhances the base properties collected with each event to include more granular OS and application version details. The review feedback focuses on maintaining consistency in the app_build property across platforms and streamlining the event tracking code by removing redundant checks.
There was a problem hiding this comment.
Pull request overview
This PR standardizes analytics tracking across macOS and Windows so both platforms emit the same PostHog event names and property keys, using shared “pageview/click/event” helper methods and consistent English property values.
Changes:
- macOS: register shared analytics base/super properties at startup; add
trackEvent/trackPageView/trackClickhelpers; emitapp_install,app_open,app_exit. - macOS + Windows: replace ad-hoc tracking calls with standardized
pageview/clickevents across windows/popovers and key interactions. - Windows: standardize chart metric/range/style property values to English and extend base properties.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| KeyStats/StatsPopoverViewController.swift | Track chart control changes and navigation clicks via AppDelegate.trackClick; remove direct PostHog usage. |
| KeyStats/SettingsWindowController.swift | Emit pageview for Settings window. |
| KeyStats/SettingsViewController.swift | Replace PostHog captures with standardized helpers for settings actions and data import/export/reset. |
| KeyStats/MouseDistanceCalibrationWindowController.swift | Emit pageview for mouse calibration window. |
| KeyStats/MenuBarController.swift | Track tray interactions and popover pageview; remove direct PostHog usage. |
| KeyStats/KeyboardHeatmapWindowController.swift | Emit pageview for keyboard heatmap window. |
| KeyStats/AppStatsWindowController.swift | Emit pageview for app stats window. |
| KeyStats/AppDelegate.swift | Register unified base properties; emit lifecycle events; add shared tracking helper methods. |
| KeyStats/AllTimeStatsWindowController.swift | Emit pageview for all-time stats window. |
| KeyStats.Windows/KeyStats/Views/SettingsWindow.xaml.cs | Emit settings pageview and track key settings actions as click. |
| KeyStats.Windows/KeyStats/Views/NotificationSettingsWindow.xaml.cs | Emit notification settings pageview. |
| KeyStats.Windows/KeyStats/Views/MouseCalibrationWindow.xaml.cs | Emit mouse calibration pageview. |
| KeyStats.Windows/KeyStats/Views/AppStatsWindow.xaml.cs | Emit app stats pageview. |
| KeyStats.Windows/KeyStats/ViewModels/StatsPopupViewModel.cs | Standardize chart control analytics property values to English. |
| KeyStats.Windows/KeyStats/App.xaml.cs | Extend base properties (app/os metadata) and align lifecycle events. |
| KeyStats.Windows/AGENTS.md | Add guideline to include standardized analytics for new windows/pages. |
| AGENTS.md | Add guideline to include standardized analytics for new windows/pages. |
| .claude/settings.local.json | Expand allowed Claude tools (WebSearch/WebFetch). |
Comments suppressed due to low confidence (1)
.claude/settings.local.json:18
- This change expands Claude tool permissions (adds
WebSearchandWebFetchfor external domains). Since this impacts repo-wide contributor tooling and has security/process implications, it should be called out explicitly in the PR description (or moved to a non-*.local.jsonfile if the intent is to keep local developer configuration out of version control).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
app_build,os,os_version,first_open_utc, etc.) registered once at startuptrackPageView/trackClick/trackEventhelpers on both platforms to replace ad-hocPostHogSDK.shared.capturecallsclicks,key_presses,7d/30d,line/bar) replacing Chinese stringsChanges
AppDelegate.swift: AddedanalyticsBaseProperties(),trackEvent/trackPageView/trackClickstatic helpers,app_install/app_open/app_exitlifecycle events,first_open_utctrackingtrackPageView/trackClickinstead of raw PostHog calls; removed directimport PostHogfrom leaf filesApp.xaml.cs: Extended super-properties withapp_build,os,os_major_version,os_version,$app_name,$app_versionStatsPopupViewModel.cs: Switched chart metric/range/style property values to EnglishTrackPageViewcalls to settings, app-stats, mouse-calibration, and notification-settings windows; addedTrackClickcalls to settings button handlersTest Plan
app_openandapp_install(first run only) events appear in PostHog with all base propertiespageviewevents with correctpage_nameclickevents with English property values🤖 Generated with Claude Code