Skip to content

Commit

Permalink
Merge pull request #20342 from wordpress-mobile/issue/20313-fix-stats…
Browse files Browse the repository at this point in the history
…-overview-type-tapped-event

Fix stats_overview_type_tapped event
  • Loading branch information
ravishanker authored Feb 29, 2024
2 parents df9fc91 + 7c2b0dc commit 1f30dda
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.wordpress.android.ui.stats.refresh.lists.widget.WidgetUpdater.StatsWi
import org.wordpress.android.ui.stats.refresh.utils.StatsDateFormatter
import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider
import org.wordpress.android.ui.stats.refresh.utils.trackGranular
import org.wordpress.android.ui.stats.refresh.utils.trackWithGranularity
import org.wordpress.android.util.AppLog
import org.wordpress.android.util.AppLog.T
import org.wordpress.android.util.LocaleManagerWrapper
Expand Down Expand Up @@ -210,11 +211,16 @@ class OverviewUseCase constructor(
}
}

@Suppress("MagicNumber")
private fun onColumnSelected(position: Int) {
analyticsTracker.trackGranular(
AnalyticsTracker.Stat.STATS_OVERVIEW_TYPE_TAPPED,
statsGranularity
)
val event = when (position) {
0 -> AnalyticsTracker.Stat.STATS_OVERVIEW_TYPE_TAPPED_VIEWS
1 -> AnalyticsTracker.Stat.STATS_OVERVIEW_TYPE_TAPPED_VISITORS
2 -> AnalyticsTracker.Stat.STATS_OVERVIEW_TYPE_TAPPED_LIKES
3 -> AnalyticsTracker.Stat.STATS_OVERVIEW_TYPE_TAPPED_COMMENTS
else -> null
}
event?.let { analyticsTracker.trackWithGranularity(it, statsGranularity) }
updateUiState { it.copy(selectedPosition = position) }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import org.wordpress.android.ui.stats.refresh.utils.StatsDateFormatter
import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider
import org.wordpress.android.ui.stats.refresh.utils.StatsUtils
import org.wordpress.android.ui.stats.refresh.utils.trackGranular
import org.wordpress.android.ui.stats.refresh.utils.trackWithGranularity
import org.wordpress.android.util.AppLog
import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper
import org.wordpress.android.viewmodel.ResourceProvider
Expand Down Expand Up @@ -289,11 +290,16 @@ class TrafficOverviewUseCase(
}
}

@Suppress("MagicNumber")
private fun onColumnSelected(position: Int) {
analyticsTracker.trackGranular(
AnalyticsTracker.Stat.STATS_OVERVIEW_TYPE_TAPPED,
lowerGranularity
)
val event = when (position) {
0 -> AnalyticsTracker.Stat.STATS_OVERVIEW_TYPE_TAPPED_VIEWS
1 -> AnalyticsTracker.Stat.STATS_OVERVIEW_TYPE_TAPPED_VISITORS
2 -> AnalyticsTracker.Stat.STATS_OVERVIEW_TYPE_TAPPED_LIKES
3 -> AnalyticsTracker.Stat.STATS_OVERVIEW_TYPE_TAPPED_COMMENTS
else -> null
}
event?.let { analyticsTracker.trackWithGranularity(it, statsGranularity) }
updateUiState { it.copy(selectedPosition = position) }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ public enum Stat {
STATS_AUTHORS_VIEW_MORE_TAPPED,
STATS_FILE_DOWNLOADS_VIEW_MORE_TAPPED,
STATS_TAPPED_BAR_CHART,
STATS_OVERVIEW_TYPE_TAPPED,
STATS_OVERVIEW_TYPE_TAPPED_VIEWS,
STATS_OVERVIEW_TYPE_TAPPED_VISITORS,
STATS_OVERVIEW_TYPE_TAPPED_COMMENTS,
STATS_OVERVIEW_TYPE_TAPPED_LIKES,
STATS_SCROLLED_TO_BOTTOM,
STATS_WIDGET_ADDED,
STATS_WIDGET_REMOVED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1193,8 +1193,14 @@ public static String getEventNameForStat(AnalyticsTracker.Stat stat) {
return "stats_clicks_item_tapped";
case STATS_TAPPED_BAR_CHART:
return "stats_bar_chart_tapped";
case STATS_OVERVIEW_TYPE_TAPPED:
return "stats_overview_type_tapped";
case STATS_OVERVIEW_TYPE_TAPPED_VIEWS:
return "stats_overview_type_tapped_views";
case STATS_OVERVIEW_TYPE_TAPPED_VISITORS:
return "stats_overview_type_tapped_visitors";
case STATS_OVERVIEW_TYPE_TAPPED_COMMENTS:
return "stats_overview_type_tapped_comments";
case STATS_OVERVIEW_TYPE_TAPPED_LIKES:
return "stats_overview_type_tapped_likes";
case STATS_DETAIL_POST_TAPPED:
return "stats_detail_post_tapped";
case STATS_SCROLLED_TO_BOTTOM:
Expand Down

0 comments on commit 1f30dda

Please sign in to comment.