1.1.5: add analytics for stats_viewed and week_rated events
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,12 @@ enum AnalyticsEvent {
|
||||
static let iCloudSyncToggled = "icloud_sync_toggled"
|
||||
static let notificationsToggled = "notifications_toggled"
|
||||
static let languageChanged = "language_changed"
|
||||
|
||||
// Stats
|
||||
static let statsViewed = "stats_viewed"
|
||||
|
||||
// Feedback loop
|
||||
static let weekRated = "week_rated"
|
||||
}
|
||||
|
||||
enum AnalyticsService {
|
||||
@@ -103,4 +109,13 @@ enum AnalyticsService {
|
||||
static func logNotificationsToggled(enabled: Bool) {
|
||||
logEvent(AnalyticsEvent.notificationsToggled, parameters: ["enabled": enabled])
|
||||
}
|
||||
|
||||
static func logStatsViewed() {
|
||||
logEvent(AnalyticsEvent.statsViewed)
|
||||
}
|
||||
|
||||
static func logWeekRated(rating: Int) {
|
||||
let value = rating == 1 ? "liked" : rating == -1 ? "disliked" : "cleared"
|
||||
logEvent(AnalyticsEvent.weekRated, parameters: ["rating": value])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,6 +168,7 @@ final class HomeViewModel: ObservableObject {
|
||||
func rateWeek(plan: WeekPlan, rating: Int) {
|
||||
plan.userRating = rating
|
||||
plan.updatedAt = Date()
|
||||
AnalyticsService.logWeekRated(rating: rating)
|
||||
HapticManager.shared.impact(style: .light)
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ struct StatsView: View {
|
||||
.padding(.vertical, 20)
|
||||
}
|
||||
.background(Color.mealMoodBackground.ignoresSafeArea())
|
||||
.onAppear { AnalyticsService.logStatsViewed() }
|
||||
.navigationTitle("stats_title")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
|
||||
Reference in New Issue
Block a user