Skip to content

Commit

Permalink
Playback 2023: Tracks (#1523)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashiagr authored Nov 8, 2023
1 parent c703da0 commit e54c5c7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ fun StoriesPage(
Box(modifier = modifier.size(dialogSize)) {
when (state) {
is State.Loaded -> {
viewModel.trackStoryShown()
viewModel.trackStoryOrUpsellShown()
StoriesView(
state = state as State.Loaded,
progress = viewModel.progress,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,16 @@ class StoriesViewModel @Inject constructor(
object Error : State()
}

fun trackStoryShown() {
fun trackStoryOrUpsellShown() {
val currentState = state.value as State.Loaded
val currentStory = requireNotNull(currentState.currentStory)
val event = if (shouldShowUpsell()) {
AnalyticsEvent.END_OF_YEAR_UPSELL_SHOWN
} else {
AnalyticsEvent.END_OF_YEAR_STORY_SHOWN
}
analyticsTracker.track(
AnalyticsEvent.END_OF_YEAR_STORY_SHOWN,
event,
AnalyticsProp.storyShown(currentStory.identifier)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ enum class AnalyticsEvent(val key: String) {
END_OF_YEAR_STORY_SHARED("end_of_year_story_shared"),
END_OF_YEAR_STORY_RETRY_BUTTON_TAPPED("end_of_year_story_retry_button_tapped"),
END_OF_YEAR_PROFILE_CARD_TAPPED("end_of_year_profile_card_tapped"),
END_OF_YEAR_UPSELL_SHOWN("end_of_year_upsell_shown"),

/* Welcome */
WELCOME_SHOWN("welcome_shown"),
Expand Down

0 comments on commit e54c5c7

Please sign in to comment.