Skip to content

fix(analytics): make telemetry opt-in instead of default-on - #482

Open
Firefly0619sec wants to merge 1 commit into
winfunc:mainfrom
Firefly0619sec:fix/analytics-opt-in
Open

Firefly0619sec wants to merge 1 commit into
winfunc:mainfrom
Firefly0619sec:fix/analytics-opt-in

Conversation

@Firefly0619sec

Copy link
Copy Markdown

Problem

Analytics is currently opt-out: ConsentManager.initialize() defaults to enabled: true, hasConsented: true, and AnalyticsConsent is never rendered, so PostHog starts on first launch without asking the user.

src/lib/analytics/consent.ts:

this.settings = {
  enabled: true,
  hasConsented: true,
};

Change

  • Default to enabled: false, hasConsented: false (all four default sites, including the error fallback and deleteAllData);
  • Render <AnalyticsConsent /> in the app root so first-run users are actually asked (the component already exists and already calls analytics.enable() / analytics.disable(), it just was not mounted).

AnalyticsService.initialize() only initializes PostHog when hasConsented && enabled, so with this change PostHog stays off until the user accepts.

Notes

  • Users who already have opcode-analytics-settings in localStorage keep their stored choice (no forced reset).
  • The Settings page already has a telemetry toggle, so users can change it later.

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