Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stats_overview_type_tapped event #20342

Merged
merged 5 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading