Skip to content

Commit

Permalink
Track opening stats from posts
Browse files Browse the repository at this point in the history
  • Loading branch information
irfano committed Feb 20, 2024
1 parent 9690fa7 commit 0668134
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class StatsActivity : LocaleAwareActivity() {
QUICK_ACTIONS("quick_actions"),
TODAY_STATS_CARD("today_stats_card"),
ROW("row"),
POSTS("posts"),
WIDGET("widget"),
NOTIFICATION("notification"),
LINK("link"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ import org.wordpress.android.ui.jetpackoverlay.JetpackFeatureRemovalOverlayUtil
import org.wordpress.android.ui.jetpackoverlay.JetpackOverlayConnectedFeature
import org.wordpress.android.ui.pages.SnackbarMessageHolder
import org.wordpress.android.ui.stats.refresh.BLOCK_DETAIL_USE_CASE
import org.wordpress.android.ui.stats.refresh.StatsActivity
import org.wordpress.android.ui.stats.refresh.lists.BaseListUseCase
import org.wordpress.android.ui.stats.refresh.utils.StatsPostProvider
import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider
import org.wordpress.android.ui.stats.refresh.utils.trackStatsAccessed
import org.wordpress.android.ui.utils.UiString.UiStringRes
import org.wordpress.android.util.NetworkUtilsWrapper
import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper
import org.wordpress.android.util.mergeNotNull
import org.wordpress.android.viewmodel.Event
import org.wordpress.android.viewmodel.ScopedViewModel
Expand All @@ -28,6 +31,7 @@ class StatsDetailViewModel
private val statsSiteProvider: StatsSiteProvider,
private val statsPostProvider: StatsPostProvider,
private val networkUtilsWrapper: NetworkUtilsWrapper,
private val analyticsTrackerWrapper: AnalyticsTrackerWrapper,
private val jetpackFeatureRemovalOverlayUtil: JetpackFeatureRemovalOverlayUtil
) : ScopedViewModel(mainDispatcher) {
private val _isRefreshing = MutableLiveData<Boolean>()
Expand All @@ -49,6 +53,11 @@ class StatsDetailViewModel
postTitle: String,
postUrl: String?
) {
analyticsTrackerWrapper.trackStatsAccessed(
statsSiteProvider.siteModel,
StatsActivity.StatsLaunchedFrom.POSTS.value
)

statsPostProvider.init(postId, postType, postTitle, postUrl)

if (jetpackFeatureRemovalOverlayUtil.shouldShowFeatureSpecificJetpackOverlay(
Expand Down

0 comments on commit 0668134

Please sign in to comment.