Replace PostHog integration with AnalyticsManager architecture
Remove old PostHogAnalytics singleton and replace with guide-based two-file architecture: AnalyticsManager (singleton wrapper with super properties, session replay, opt-out, subscription funnel) and AnalyticsEvent (type-safe enum with associated values). Key changes: - New API key, self-hosted analytics endpoint - All 19 events ported to type-safe AnalyticsEvent enum - Screen tracking via AnalyticsManager.Screen enum + SwiftUI modifier - Remove all identify() calls — fully anonymous analytics - Add lifecycle hooks: flush on background, update super properties on foreground - Add privacy opt-out toggle in Settings - Subscription funnel methods ready for IAP integration Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -311,7 +311,7 @@ struct TaskFormView: View {
|
||||
.onAppear {
|
||||
// Track screen view for new tasks
|
||||
if !isEditMode {
|
||||
PostHogAnalytics.shared.screen(AnalyticsEvents.newTaskScreenShown)
|
||||
AnalyticsManager.shared.trackScreen(.newTask)
|
||||
}
|
||||
// Set defaults when lookups are available
|
||||
if dataManager.lookupsInitialized {
|
||||
@@ -521,7 +521,7 @@ struct TaskFormView: View {
|
||||
viewModel.createTask(request: request) { success in
|
||||
if success {
|
||||
// Track task creation
|
||||
PostHogAnalytics.shared.capture(AnalyticsEvents.taskCreated, properties: ["residence_id": actualResidenceId])
|
||||
AnalyticsManager.shared.track(.taskCreated(residenceId: actualResidenceId))
|
||||
// View will dismiss automatically via onChange
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user