Files
honeyDueKMP/composeApp/src/commonMain/kotlin/com/tt/honeyDue/analytics/Analytics.kt
Trey T 944161f0d1 P2 Stream E: FeatureComparisonScreen (replaces FeatureComparisonDialog)
Full-screen feature comparison matching iOS FeatureComparisonView.
Two-column table, iOS-equivalent row set, CTA to upgrade flow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 13:12:21 -05:00

86 lines
3.9 KiB
Kotlin

package com.tt.honeyDue.analytics
/**
* Common analytics interface for cross-platform event tracking.
* Platform-specific implementations use PostHog SDKs.
*/
expect object PostHogAnalytics {
fun initialize()
fun identify(userId: String, properties: Map<String, Any>? = null)
fun capture(event: String, properties: Map<String, Any>? = null)
fun captureException(throwable: Throwable, properties: Map<String, Any>? = null)
fun screen(screenName: String, properties: Map<String, Any>? = null)
fun reset()
fun flush()
fun setupExceptionHandler()
}
/**
* Analytics event names - use these constants for consistency across the app
*/
object AnalyticsEvents {
// Authentication
const val REGISTRATION_SCREEN_SHOWN = "registration_screen_shown"
const val USER_REGISTERED = "user_registered"
const val USER_SIGNED_IN = "user_signed_in"
const val USER_SIGNED_IN_APPLE = "user_signed_in_apple"
// Residence
const val RESIDENCE_SCREEN_SHOWN = "residence_screen_shown"
const val NEW_RESIDENCE_SCREEN_SHOWN = "new_residence_screen_shown"
const val RESIDENCE_CREATED = "residence_created"
const val RESIDENCE_JOINED = "residence_joined"
const val RESIDENCE_LIMIT_REACHED = "residence_limit_reached"
// Task
const val TASK_SCREEN_SHOWN = "task_screen_shown"
const val NEW_TASK_SCREEN_SHOWN = "new_task_screen_shown"
const val TASK_CREATED = "task_created"
// Onboarding — First Task screen funnel
// Fired by both iOS and Android with identical event names so the
// PostHog funnel is cross-platform. Properties documented next to each.
// ONBOARDING_SUGGESTIONS_LOADED: {"count": Int, "profile_completeness": Double}
// ONBOARDING_SUGGESTION_ACCEPTED: {"template_id": Int, "relevance_score": Double}
// ONBOARDING_BROWSE_TEMPLATE_ACCEPTED: {"template_id": Int, "category": String?}
// ONBOARDING_TASKS_CREATED: {"count": Int}
// ONBOARDING_TASK_STEP_SKIPPED: {"reason": "network_error" | "user_skip"}
const val ONBOARDING_SUGGESTIONS_LOADED = "onboarding_suggestions_loaded"
const val ONBOARDING_SUGGESTION_ACCEPTED = "onboarding_suggestion_accepted"
const val ONBOARDING_BROWSE_TEMPLATE_ACCEPTED = "onboarding_browse_template_accepted"
const val ONBOARDING_TASKS_CREATED = "onboarding_tasks_created"
const val ONBOARDING_TASK_STEP_SKIPPED = "onboarding_task_step_skipped"
// Contractor
const val CONTRACTOR_SCREEN_SHOWN = "contractor_screen_shown"
const val NEW_CONTRACTOR_SCREEN_SHOWN = "new_contractor_screen_shown"
const val CONTRACTOR_CREATED = "contractor_created"
const val CONTRACTOR_PAYWALL_SHOWN = "contractor_paywall_shown"
// Documents
const val DOCUMENTS_SCREEN_SHOWN = "documents_screen_shown"
const val NEW_DOCUMENT_SCREEN_SHOWN = "new_document_screen_shown"
const val DOCUMENT_CREATED = "document_created"
const val DOCUMENTS_PAYWALL_SHOWN = "documents_paywall_shown"
// Sharing
const val SHARE_RESIDENCE_SCREEN_SHOWN = "share_residence_screen_shown"
const val RESIDENCE_SHARED = "residence_shared"
const val SHARE_RESIDENCE_PAYWALL_SHOWN = "share_residence_paywall_shown"
const val SHARE_CONTRACTOR_SCREEN_SHOWN = "share_contractor_screen_shown"
const val CONTRACTOR_SHARED = "contractor_shared"
const val SHARE_CONTRACTOR_PAYWALL_SHOWN = "share_contractor_paywall_shown"
// Settings
const val NOTIFICATION_SETTINGS_SCREEN_SHOWN = "notification_settings_screen_shown"
const val SETTINGS_SCREEN_SHOWN = "settings_screen_shown"
const val THEME_CHANGED = "theme_changed"
// Subscription / Paywall
// PAYWALL_COMPARE_CTA: fired when the user taps the "Upgrade to Pro" CTA
// from the FeatureComparisonScreen (the full-screen Free vs. Pro
// comparison table). Lets the funnel attribute conversions to the
// comparison surface rather than the generic upgrade entry point.
const val PAYWALL_COMPARE_CTA = "paywall_compare_cta"
}