Skip to content

Add anonymous analytics to release builds#105

Merged
SunkenInTime merged 5 commits into
mainfrom
feature/analytics-release
Jul 20, 2026
Merged

Add anonymous analytics to release builds#105
SunkenInTime merged 5 commits into
mainfrom
feature/analytics-release

Conversation

@SunkenInTime

Copy link
Copy Markdown
Owner

Summary

  • Adds a small anonymous analytics layer backed by PostHog, including install-scoped IDs, opt-out support, and privacy-safe event capture.
  • Logs key usage events such as app opens, strategy creation/import, lineup creation, and content exports with minimal properties.
  • Adds a new Privacy section in Settings so users can disable analytics.
  • Wires release builds and CI to pass POSTHOG_PROJECT_TOKEN securely via temporary Dart defines, and documents the analytics setup.
  • Bumps the app version to 4.5.1+94 and includes the new release metadata.

Testing

  • Not run.
  • Verified the release scripts now create and clean up temporary Dart-defines files when analytics is configured.
  • Verified analytics is initialized after Hive boxes are opened and before normal app usage begins.
  • Verified the Settings UI exposes an opt-out toggle under Privacy.
  • Verified the tracked events are limited to anonymous product events with no strategy content or personal data.

- Capture opt-out anonymous product events
- Thread PostHog token through release scripts and workflows
- Add privacy controls and analytics release notes
@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds anonymous analytics for release builds. The main changes are:

  • PostHog capture service with install-scoped IDs and opt-out storage.
  • Privacy settings toggle for anonymous analytics.
  • Usage events for app opens, strategy actions, lineup creation, and exports.
  • Release scripts and workflows that pass PostHog Dart defines through temporary files.
  • Version and release metadata updates for 4.5.1+94.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
scripts/build_store_release.ps1 Cleans the Windows build output, builds Windows with optional PostHog Dart defines, and packages the existing build.
scripts/build_desktop_release.ps1 Adds temporary Dart-define file handling for desktop release builds.
lib/services/analytics_service.dart Adds anonymous analytics capture, install ID storage, opt-out state, and no-op behavior when analytics is not configured.
lib/widgets/settings_tab.dart Adds the Privacy settings section and analytics toggle.

Reviews (4): Last reviewed commit: "Prevent stale Store build packaging" | Re-trigger Greptile

Comment thread scripts/build_store_release.ps1 Outdated
@SunkenInTime

Copy link
Copy Markdown
Owner Author

Addressed the current Greptile review feedback in 21c98a7 and fixed the release-version CI failure in ca524a6.

@greptileai

Comment thread scripts/build_store_release.ps1 Outdated
@SunkenInTime

Copy link
Copy Markdown
Owner Author

Removed the nested MSIX argument forwarding in b36d587. The Store script now runs Flutter's Windows build directly with the Dart define file, then packages that output with MSIX rebuilding disabled.

@greptileai

Comment thread scripts/build_store_release.ps1
@SunkenInTime

Copy link
Copy Markdown
Owner Author

Made the Store packaging handoff deterministic in 358PLACEHOLDER by clearing only the generated build/windows tree before Flutter compiles with the analytics defines. MSIX packaging now has no stale Windows output to fall back to and fails if the new build is absent.

@SunkenInTime

Copy link
Copy Markdown
Owner Author

Correction: the deterministic Store packaging fix is in 94e8281. The generated build/windows tree is cleared before Flutter compiles with the analytics defines, so MSIX has no stale output to package and fails if the fresh build is absent.

@greptileai

@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Thanks for the clarification. That makes sense — clearing build/windows before the analytics-defines Flutter build ensures msix:create can only pick up freshly compiled binaries that include the PostHog token, and the hard failure (throw "No MSIX or Store upload package was found...") acts as a safety net rather than silently packaging stale output. The approach is sound.

@SunkenInTime

Copy link
Copy Markdown
Owner Author

The current head 94e8281 includes the deterministic clean-build handoff you confirmed as sound. Please run a full review of the current head and update the confidence score.

@greptileai

@SunkenInTime
SunkenInTime merged commit 9ffd336 into main Jul 20, 2026
2 checks passed
@SunkenInTime
SunkenInTime deleted the feature/analytics-release branch July 20, 2026 18:55
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