fix(analytics): harden analytics opt-out and feedback surfaces (#423)

Server stops phoning Sentry home after opt-out (release-health sessions + client reports off); settings saves diff-send only changed keys so a stale tab cannot revert an instance-wide opt-out; disabling analytics hides the feedback UI immediately; optIn resumes PostHog after re-enable; onboarding survey writes time out at 15s; inline tool-feedback prompt arms a shown-cooldown.
This commit is contained in:
SnapOtter
2026-07-04 14:02:28 +08:00
committed by GitHub
parent 6e3a14ec6b
commit 23efce9df0
11 changed files with 233 additions and 33 deletions
+5
View File
@@ -27,6 +27,11 @@ if (ANALYTICS_BAKED.sentryDsn) {
environment: process.env.NODE_ENV || "production",
tracesSampleRate: ANALYTICS_BAKED.sampleRate,
sendDefaultPii: false,
// Release-health request-sessions and client-report envelopes are sent outside
// beforeSend/beforeSendTransaction, so the runtime opt-out below would not stop
// them. Disable both so an opted-out instance truly stops phoning home.
integrations: [Sentry.httpIntegration({ trackIncomingRequestsAsSessions: false })],
sendClientReports: false,
// Runtime opt-out: drop the whole transaction when analytics is off.
tracesSampler: () => (sentryActive() ? ANALYTICS_BAKED.sampleRate : 0),
beforeSend(event) {