Repository navigation
feat: anonymous PostHog analytics with opt-out - #1191
Merged
Merged
Conversation
Anonymous random id in localStorage (no IP, no autocapture, no replay) to count users and return visits, plus device connection and error events with model-level device facts only. Adds a Share anonymous diagnostics switch in Interface settings (all locales), pins the CSP to the US PostHog hosts, and raises the JS budget to 3_150_000 (posthog-js added about 340 kB; measured 3_125_815).
Contributor
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
⛔ Files ignored due to path filters: 1
📒 Files selected for processing: 25
✨ Finishing Touches
Comment |
Deploying openmouse with
|
| Latest commit: |
7504f7a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3646cb64.openmouse.pages.dev |
| Branch Preview URL: | https://feat-posthog-analytics.openmouse.pages.dev |
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — This PR introduces default-on PostHog telemetry, automatic exception reporting, persistent browser analytics state, external CSP permissions, and a user-facing opt-out control across production paths. The integration and its privacy/data-handling implications require human review even though the supplied findings appear addressed in the final code. Notes:
You can add or adjust custom eligibility rules. Learn more. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds PostHog (US region) to count users, see who comes back, and see device connection errors.
src/platform/analytics.ts: anonymous random id in localStorage,ip: false, no autocapture, no session replay, respects Do Not Track,person_profiles: identified_only. No-op whenVITE_POSTHOG_KEY/VITE_POSTHOG_HOSTare unset (dev, forks, previews).device_connected,device_connection_failed,device_not_a_mouse,device_error(vendor id, product id, product name, scrubbed error name and message), pluspending_changes_applied,diagnostics_downloaded, hardware test and game request events. Serials, receiver ids and user text are never sent.us.i.posthog.comandus-assets.i.posthog.com; tests updated.Before merging
VITE_POSTHOG_KEYandVITE_POSTHOG_HOSTin Cloudflare Pages (done by the owner).device_connection_succeeded; it is nowdevice_connected.Checks
npm run build,npm test(400 pass),npm run sizepass. Not yet verified: events arriving from a deployed build.Note
Add anonymous PostHog analytics with opt-out setting and event tracking
VITE_POSTHOG_*env vars, with anonymous localStorage persistence, no IP capture, no autocapture or session recording, and scrubbing of emails, paths, hex IDs, and stack-frame URLs before events are sentposthog-jsin CIdevice.connectnow emitsdevice_connected,device_not_a_mouse, ordevice_connection_failedinstead of the generic diagnostic event; check the suppressed generic diagnostic analytics path in controller.tsMacroscope summarized 7504f7a.