2.0: analytics — log onboarding step as String + step_name for GA4 drop-off

GA4 text custom dimensions do not capture numeric params (step showed as
"(not set)"). Log step as String and add a readable step_name so the
onboarding drop-off is queryable. Registered source/environment/step_name
custom dimensions in the GA4 property to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Df9kZEUMXPLn4Kb9Zx1f5o
This commit is contained in:
alexandrev-tibco
2026-07-21 09:19:50 +02:00
parent 029e8d7e1a
commit 148a301d6c
+14 -1
View File
@@ -107,8 +107,21 @@ enum AnalyticsService {
logEvent(AnalyticsEvent.onboardingCompleted, parameters: ["dish_count": dishCount]) logEvent(AnalyticsEvent.onboardingCompleted, parameters: ["dish_count": dishCount])
} }
// Human-readable names for each onboarding step, indexed by step number.
// Keep in sync with the OnboardingView step order.
private static let onboardingStepNames = [
"0_welcome", "1_meal_windows", "2_weekends",
"3_calendar", "4_first_dishes", "5_paywall"
]
static func logOnboardingStepViewed(step: Int) { static func logOnboardingStepViewed(step: Int) {
logEvent(AnalyticsEvent.onboardingStepViewed, parameters: ["step": step]) // GA4 text custom dimensions do not capture numeric params (they show as
// "(not set)"). Log the step as a String so the drop-off is queryable.
let name = step >= 0 && step < onboardingStepNames.count ? onboardingStepNames[step] : "\(step)"
logEvent(AnalyticsEvent.onboardingStepViewed, parameters: [
"step": "\(step)",
"step_name": name
])
} }
static func logAutoAssignUsed(filledSlots: Int, unfilledSlots: Int) { static func logAutoAssignUsed(filledSlots: Int, unfilledSlots: Int) {