CMM-2213: Attach selected site to My Site dashboard card impressions - #23186
Draft
jkmassel wants to merge 1 commit into
Draft
CMM-2213: Attach selected site to My Site dashboard card impressions#23186jkmassel wants to merge 1 commit into
jkmassel wants to merge 1 commit into
Conversation
`MY_SITE_DASHBOARD_CARD_SHOWN` fired through the bare `AnalyticsTrackerWrapper.track(stat, properties)`, so `jpandroid_my_site_dashboard_card_shown` and its WordPress twin carried `type` and `subtype` but no `blog_id` — 0.0% coverage across a 14-day window, versus 96.8% on the sibling `my_site_tab_accessed` fired from the same screen. Route the call through the site-aware `track(stat, site, properties)` overload, reading the currently selected site from `SelectedSiteRepository`. The My Site tab always shows exactly one site, and `trackWithSiteDetails` attaches `blog_id`, `is_jetpack`, and `site_type` for WP.com and Jetpack-connected sites. One shared call site, so both the Jetpack and WordPress Android apps are fixed at once.
Collaborator
Generated by 🚫 Danger |
Contributor
|
|
Contributor
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #23186 +/- ##
=======================================
Coverage 37.90% 37.91%
=======================================
Files 2348 2348
Lines 127702 127704 +2
Branches 17734 17734
=======================================
+ Hits 48411 48413 +2
Misses 75331 75331
Partials 3960 3960 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes CMM-2213. The My Site dashboard "card shown" impression event fires with no
blog_id, even though the screen always displays exactly one, known site.Root Cause
CardsShownTrackerfiredMY_SITE_DASHBOARD_CARD_SHOWNthrough the plainAnalyticsTrackerWrapper.track(stat, properties), which attaches no site details:analyticsTrackerWrapper.track( Stat.MY_SITE_DASHBOARD_CARD_SHOWN, mapOf(CardsTracker.TYPE to pair.first, CardsTracker.SUBTYPE to pair.second) )Data Science measured
blog_idat 0.0% onjpandroid_my_site_dashboard_card_shown(6.0M fires) andwpandroid_my_site_dashboard_card_shown(4k fires) across a 14-day window, versus 96.8% onjpandroid_my_site_tab_accessedfired from the same screen. 100% of the rows areuseridtype = 'wpcom:user_id', so the user is known — only the site was absent. 19 funnels depend on the Jetpack event and 27 on the WordPress one.Fix
Route the call through the existing site-aware
track(stat, site, properties)overload, passing the currently selected site fromSelectedSiteRepository:analyticsTrackerWrapper.track( Stat.MY_SITE_DASHBOARD_CARD_SHOWN, selectedSiteRepository.getSelectedSite(), mapOf(CardsTracker.TYPE to pair.first, CardsTracker.SUBTYPE to pair.second) )That overload delegates to
AnalyticsUtils.trackWithSiteDetails(...), which addsblog_id,is_jetpack, andsite_typefor WP.com and Jetpack-connected sites while preservingtypeandsubtype. It is one shared call site, so both Android apps are fixed at once.Coverage is expected to land at or above 95% rather than 100% —
trackWithSiteDetailsonly attachesblog_idfor sites accessed via the WP.com REST API, so the small fraction of self-hosted, non-Jetpack sites remains without one by design.Description
CardsShownTrackernow injectsSelectedSiteRepositoryand attaches the selected site to the impression event.Out of scope
jpandroid_my_site_dashboard_card_shown,wpandroid_my_site_dashboard_card_shown, andjpandroid_my_site_tab_accessedhappens in the Tracks event registry, not in this repo — tracked as a separate follow-up.jpios_my_site_dashboard_card_shownsits at 56.1% via a different code path; that is a separate defect and not addressed here.Testing instructions
Automated:
./gradlew :WordPress:testJetpackDebugUnitTest --tests "*.CardsShownTrackerTest"CardsShownTrackerTestpasses; each card-shown assertion verifies the selected site is attached.Manual (with Tracks debug logging):
my_site_dashboard_card_shownevents includeblog_id(andis_jetpack/site_type) alongsidetypeandsubtype.Post-deploy verification:
blog_id_pctat or above 95 on bothcard_shownevents.