diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/OverviewUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/OverviewUseCase.kt index c70fd14e97fa..60773b85b864 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/OverviewUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/granular/usecases/OverviewUseCase.kt @@ -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 @@ -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) } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficOverviewUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficOverviewUseCase.kt index 11a965ba8c33..6dd519a3849e 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficOverviewUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/traffic/TrafficOverviewUseCase.kt @@ -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 @@ -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) } } diff --git a/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java b/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java index cd82eeba7497..27d27b6fb851 100644 --- a/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java +++ b/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java @@ -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, diff --git a/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java b/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java index 211770c1418c..e22e50fc67b3 100644 --- a/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java +++ b/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTrackerNosara.java @@ -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: