From 00a52dd1feee7b54129cce4a3544da5fc64847a8 Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Thu, 29 Feb 2024 22:14:50 +0300 Subject: [PATCH 1/5] Create stats_overview_typed_tapped events for each column --- .../org/wordpress/android/analytics/AnalyticsTracker.java | 4 ++++ .../android/analytics/AnalyticsTrackerNosara.java | 8 ++++++++ 2 files changed, 12 insertions(+) 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..1abd063d16de 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,6 +134,10 @@ public enum Stat { STATS_AUTHORS_VIEW_MORE_TAPPED, STATS_FILE_DOWNLOADS_VIEW_MORE_TAPPED, STATS_TAPPED_BAR_CHART, + STATS_OVERVIEW_TYPE_TAPPED_VIEWS, + STATS_OVERVIEW_TYPE_TAPPED_VISITORS, + STATS_OVERVIEW_TYPE_TAPPED_COMMENTS, + STATS_OVERVIEW_TYPE_TAPPED_LIKES, STATS_OVERVIEW_TYPE_TAPPED, STATS_SCROLLED_TO_BOTTOM, STATS_WIDGET_ADDED, 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..e113b619f5a9 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,6 +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_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_OVERVIEW_TYPE_TAPPED: return "stats_overview_type_tapped"; case STATS_DETAIL_POST_TAPPED: From ec5953054dbde9d18583b3133f282f433e41182f Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Thu, 29 Feb 2024 22:15:21 +0300 Subject: [PATCH 2/5] Track stats_overview_typed_tapped event for each column --- .../sections/traffic/TrafficOverviewUseCase.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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..72f4f46071c7 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 @@ -290,10 +291,14 @@ class TrafficOverviewUseCase( } 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) } } From 00e6811a2e519514b1473e01484a4c0f37e8391d Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Thu, 29 Feb 2024 23:35:49 +0300 Subject: [PATCH 3/5] Track stats_overview_typed_tapped for each column on granularity tabs --- .../sections/granular/usecases/OverviewUseCase.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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..76505070f79d 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 @@ -211,10 +212,14 @@ class OverviewUseCase constructor( } 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) } } From 97cb57309445dbc60fa2312f7f7fbbd78c082320 Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Thu, 29 Feb 2024 23:38:02 +0300 Subject: [PATCH 4/5] Remove ununsed stats_overview_typed_tapped event --- .../java/org/wordpress/android/analytics/AnalyticsTracker.java | 1 - .../org/wordpress/android/analytics/AnalyticsTrackerNosara.java | 2 -- 2 files changed, 3 deletions(-) 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 1abd063d16de..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 @@ -138,7 +138,6 @@ public enum Stat { STATS_OVERVIEW_TYPE_TAPPED_VISITORS, STATS_OVERVIEW_TYPE_TAPPED_COMMENTS, STATS_OVERVIEW_TYPE_TAPPED_LIKES, - STATS_OVERVIEW_TYPE_TAPPED, 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 e113b619f5a9..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 @@ -1201,8 +1201,6 @@ public static String getEventNameForStat(AnalyticsTracker.Stat stat) { return "stats_overview_type_tapped_comments"; case STATS_OVERVIEW_TYPE_TAPPED_LIKES: return "stats_overview_type_tapped_likes"; - case STATS_OVERVIEW_TYPE_TAPPED: - return "stats_overview_type_tapped"; case STATS_DETAIL_POST_TAPPED: return "stats_detail_post_tapped"; case STATS_SCROLLED_TO_BOTTOM: From 7c2b0dce5c8016a4abc81666817bf05349df9810 Mon Sep 17 00:00:00 2001 From: Ravi Date: Fri, 1 Mar 2024 10:02:36 +1100 Subject: [PATCH 5/5] Fix detekt warning --- .../refresh/lists/sections/granular/usecases/OverviewUseCase.kt | 1 + .../refresh/lists/sections/traffic/TrafficOverviewUseCase.kt | 1 + 2 files changed, 2 insertions(+) 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 76505070f79d..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 @@ -211,6 +211,7 @@ class OverviewUseCase constructor( } } + @Suppress("MagicNumber") private fun onColumnSelected(position: Int) { val event = when (position) { 0 -> AnalyticsTracker.Stat.STATS_OVERVIEW_TYPE_TAPPED_VIEWS 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 72f4f46071c7..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 @@ -290,6 +290,7 @@ class TrafficOverviewUseCase( } } + @Suppress("MagicNumber") private fun onColumnSelected(position: Int) { val event = when (position) { 0 -> AnalyticsTracker.Stat.STATS_OVERVIEW_TYPE_TAPPED_VIEWS