Skip to content

CMM-2213: Attach selected site to My Site dashboard card impressions - #23186

Draft
jkmassel wants to merge 1 commit into
trunkfrom
cmm-2213-my-site-dashboard-card-impressions-on-android-carry-no
Draft

CMM-2213: Attach selected site to My Site dashboard card impressions#23186
jkmassel wants to merge 1 commit into
trunkfrom
cmm-2213-my-site-dashboard-card-impressions-on-android-carry-no

Conversation

@jkmassel

@jkmassel jkmassel commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

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

CardsShownTracker fired MY_SITE_DASHBOARD_CARD_SHOWN through the plain AnalyticsTrackerWrapper.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_id at 0.0% on jpandroid_my_site_dashboard_card_shown (6.0M fires) and wpandroid_my_site_dashboard_card_shown (4k fires) across a 14-day window, versus 96.8% on jpandroid_my_site_tab_accessed fired from the same screen. 100% of the rows are useridtype = '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 from SelectedSiteRepository:

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 adds blog_id, is_jetpack, and site_type for WP.com and Jetpack-connected sites while preserving type and subtype. 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% — trackWithSiteDetails only attaches blog_id for sites accessed via the WP.com REST API, so the small fraction of self-hosted, non-Jetpack sites remains without one by design.

Description

  • CardsShownTracker now injects SelectedSiteRepository and attaches the selected site to the impression event.
  • Unit tests updated to assert the site is threaded through on every card-shown event.
  • No user-facing behavior change, so no release note.

Out of scope

  • Event registration (Part 2 of the issue). Registering jpandroid_my_site_dashboard_card_shown, wpandroid_my_site_dashboard_card_shown, and jpandroid_my_site_tab_accessed happens in the Tracks event registry, not in this repo — tracked as a separate follow-up.
  • iOS. jpios_my_site_dashboard_card_shown sits at 56.1% via a different code path; that is a separate defect and not addressed here.

Testing instructions

Automated:

  1. Run ./gradlew :WordPress:testJetpackDebugUnitTest --tests "*.CardsShownTrackerTest"
  • CardsShownTrackerTest passes; each card-shown assertion verifies the selected site is attached.

Manual (with Tracks debug logging):

  1. Build a debug variant and open the My Site tab signed in to a WordPress.com or Jetpack-connected site so the dashboard cards render.
  • my_site_dashboard_card_shown events include blog_id (and is_jetpack / site_type) alongside type and subtype.

Post-deploy verification:

  • The issue's verification query reports blog_id_pct at or above 95 on both card_shown events.

`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.
@dangermattic

Copy link
Copy Markdown
Collaborator
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
Build TypeDebug
Versionpr23186-fbb1759
Build Number1498
Application IDorg.wordpress.android.prealpha
Commitfbb1759
Installation URL46hmlmpga5smg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in Jetpack Android by scanning the QR code below to install the corresponding build.

App NameJetpack Android
Build TypeDebug
Versionpr23186-fbb1759
Build Number1498
Application IDcom.jetpack.android.prealpha
Commitfbb1759
Installation URL5498oi7cor9b8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 37.91%. Comparing base (6d3a3c8) to head (fbb1759).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants