merge: feat/activation-analytics — consent-gated PostHog activation funnel (reviewed: APPROVE after fixes)

This commit is contained in:
engineer
2026-07-16 16:09:27 -07:00
17 changed files with 450 additions and 18 deletions

View File

@@ -16,6 +16,7 @@ import { TelemetryConsentModal } from "../src/components/TelemetryConsentModal"
import * as notifications from "../src/lib/notifications"
import { addBreadcrumb, wrap } from "../src/lib/sentry"
import { loadTelemetryConsent, setTelemetryConsent } from "../src/lib/telemetry"
import { initAnalytics, trackAppOpened } from "../src/lib/analytics"
const queryClient = new QueryClient()
@@ -51,6 +52,8 @@ function RootLayout() {
initSentry()
addBreadcrumb({ category: "app.lifecycle", message: "app started" })
})
initAnalytics()
trackAppOpened()
setConsentState("decided")
} else if (state === "denied") {
addBreadcrumb({ category: "app.lifecycle", message: "app started (telemetry off)" })

View File

@@ -84,6 +84,7 @@ export default function EditConnectionScreen() {
directory: directory.trim() || undefined,
username: username.trim() || undefined,
},
"edit_test",
password || undefined,
)

View File

@@ -18,6 +18,7 @@ import type { ConnectionType } from "../../src/lib/types"
import { probeConnection, shareReport } from "../../src/lib/diagnostics"
import { captureDiagnostic } from "../../src/lib/sentry"
import { parseUrl } from "../../src/lib/diagnostics-classify"
import { AnalyticsEvent, track } from "../../src/lib/analytics"
export default function AddConnectionScreen() {
const colorScheme = useColorScheme()
@@ -67,6 +68,7 @@ export default function AddConnectionScreen() {
return
}
track(AnalyticsEvent.ConnectionFormSubmitted, { mode: "quick" })
setIsConnecting(true)
// Test connection first
@@ -78,6 +80,7 @@ export default function AddConnectionScreen() {
url: serverUrl,
username: username.trim() || undefined,
},
"onboarding",
password || undefined,
)
@@ -127,6 +130,11 @@ export default function AddConnectionScreen() {
return
}
track(AnalyticsEvent.ConnectionFormSubmitted, { mode: "advanced" })
// Advanced mode saves directly without a pre-flight health check (see
// useConnections.addConnection), so unlike quick-connect there is no
// success/failure signal to report here — only that an attempt was made.
track(AnalyticsEvent.ConnectionAttempted, { source: "onboarding" })
setIsConnecting(true)
await addConnection(
{