Add PostHog analytics integration for Android and iOS
Implement comprehensive analytics tracking across both platforms: Android (Kotlin): - Add PostHog SDK dependency and initialization in MainActivity - Create expect/actual pattern for cross-platform analytics (commonMain/androidMain/iosMain/jvmMain/jsMain/wasmJsMain) - Track screen views: registration, login, residences, tasks, contractors, documents, notifications, profile - Track key events: user_registered, user_signed_in, residence_created, task_created, contractor_created, document_created - Track paywall events: contractor_paywall_shown, documents_paywall_shown - Track sharing events: residence_shared, contractor_shared - Track theme_changed event iOS (Swift): - Add PostHog iOS SDK via SPM - Create PostHogAnalytics wrapper and AnalyticsEvents constants - Initialize SDK in iOSApp with session replay support - Track same screen views and events as Android - Track user identification after login/registration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -230,6 +230,9 @@ struct ResidenceFormView: View {
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
if !isEditMode {
|
||||
PostHogAnalytics.shared.screen(AnalyticsEvents.newResidenceScreenShown)
|
||||
}
|
||||
loadResidenceTypes()
|
||||
initializeForm()
|
||||
if isEditMode && isCurrentUserOwner {
|
||||
@@ -368,6 +371,10 @@ struct ResidenceFormView: View {
|
||||
// Add mode
|
||||
viewModel.createResidence(request: request) { success in
|
||||
if success {
|
||||
// Track residence created
|
||||
PostHogAnalytics.shared.capture(AnalyticsEvents.residenceCreated, properties: [
|
||||
"residence_type": selectedPropertyType?.name ?? "unknown"
|
||||
])
|
||||
onSuccess?()
|
||||
isPresented = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user