From 6fe56e803bf2871ea3bc79b825b9f03be3c8f549 Mon Sep 17 00:00:00 2001 From: Firefly0619sec Date: Fri, 23 Oct 2026 19:47:23 +0800 Subject: [PATCH] fix(analytics): opt-in analytics instead of default-on --- src/App.tsx | 2 ++ src/lib/analytics/consent.ts | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 1eb89e8b1..a073b4d21 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -25,6 +25,7 @@ import { TabManager } from "@/components/TabManager"; import { TabContent } from "@/components/TabContent"; import { useTabState } from "@/hooks/useTabState"; import { useAppLifecycle, useTrackEvent } from "@/hooks"; +import { AnalyticsConsent } from "@/components/AnalyticsConsent"; import { StartupIntro } from "@/components/StartupIntro"; type View = @@ -531,6 +532,7 @@ function App() { + diff --git a/src/lib/analytics/consent.ts b/src/lib/analytics/consent.ts index 0ef1ce315..9960bff8a 100644 --- a/src/lib/analytics/consent.ts +++ b/src/lib/analytics/consent.ts @@ -24,8 +24,8 @@ export class ConsentManager { } else { // Initialize with default settings this.settings = { - enabled: true, - hasConsented: true, + enabled: false, + hasConsented: false, }; } @@ -41,15 +41,15 @@ export class ConsentManager { } return this.settings || { - enabled: true, - hasConsented: true, + enabled: false, + hasConsented: false, }; } catch (error) { console.error('Failed to initialize consent manager:', error); // Return default settings on error return { - enabled: true, - hasConsented: true, + enabled: false, + hasConsented: false, }; } } @@ -82,8 +82,8 @@ export class ConsentManager { // Reset settings with new anonymous ID this.settings = { - enabled: true, - hasConsented: true, + enabled: false, + hasConsented: false, userId: this.generateAnonymousId(), sessionId: this.generateSessionId(), };