Skip to content

Polish new Stats Traffic tab defaults and UTM card headers#22789

Merged
adalpari merged 2 commits intotrunkfrom
feat/stats-default-cards
Apr 10, 2026
Merged

Polish new Stats Traffic tab defaults and UTM card headers#22789
adalpari merged 2 commits intotrunkfrom
feat/stats-default-cards

Conversation

@adalpari
Copy link
Copy Markdown
Contributor

@adalpari adalpari commented Apr 10, 2026

Description

Two small polish changes to the new stats screen:

  1. Reduce default Traffic tab cards — Show only 4 cards by default (Today's Stats, Views, Most Viewed Posts & Pages, Locations) instead of 8, so the initial experience is less overwhelming.

  2. Clean up UTM card column headers — Remove the redundant left column title (already visible in the category dropdown selector) and hide column headers entirely during loading state.

Testing instructions

Default cards:

  1. Clear app data or log in to a site that has never configured stats cards
  2. Navigate to Stats > Traffic tab
  • Verify only 4 cards are shown: Today's Stats, Views, Most Viewed Posts & Pages, Locations
  • Verify the remaining cards (Referrers, Authors, Clicks, etc.) can still be added via card configuration

UTM card headers:

  1. Navigate to Stats > Traffic tab and add the UTM card if not visible
  2. Observe the UTM card while it loads
  • Verify no column headers are shown during the loading/shimmer state

adalpari and others added 2 commits April 10, 2026 10:35
Reduce the default visible cards in the Traffic tab from 8 to 4,
keeping only Today's Stats, Views, Most Viewed Posts & Pages, and
Locations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove the redundant left column title (already shown in the category
dropdown) and hide column headers while data is loading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dangermattic
Copy link
Copy Markdown
Collaborator

dangermattic commented Apr 10, 2026

1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@adalpari
Copy link
Copy Markdown
Contributor Author

@claude

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Apr 10, 2026

Claude finished @adalpari's task in 1m 32s —— View job


Code Review

  • Gather context from PR description and changed files
  • Review StatsCardType.kt changes
  • Review UtmCard.kt changes
  • Post review feedback

Clean, focused PR. Two small concerns worth flagging:

UtmCard.kt — Reusing stats_countries_views_header string

In LoadedContent, the right-aligned column header now directly uses R.string.stats_countries_views_header (line 199):

Text(
    text = stringResource(R.string.stats_countries_views_header),
    ...
)

This string is named after the Locations/Countries card. While the text value is just "Views" and is semantically correct for UTM too, borrowing a country-specific string creates a hidden coupling — if the Locations card ever renames or rephrases that string, the UTM card's header would silently change. A dedicated R.string.stats_utm_views_header (or a more generic R.string.stats_views_column_header) would be safer. That said, since the string value is generic ("Views"), this is a minor concern. Fix this →

StatsCardsConfigurationTest.kt — No explicit assertion on defaultCards() contents

StatsCardsConfigurationTest only checks that the default config's visibleCards equals defaultCards() — it doesn't assert which specific cards are in that list. A regression test that explicitly asserts the 4-card default set would make future changes to defaultCards() more visible and intentional. This is low priority but worth considering.

Everything else looks good

  • Trimming defaultCards() from 8 → 4 cards is a clean, minimal change.
  • Removing StatsListHeader from the loading/shimmer state is correct — column labels during loading are noise.
  • The StatsListHeader import is properly cleaned up.
  • Existing tests don't need updates since the affected test uses defaultCards() dynamically.
    | Branch

@adalpari
Copy link
Copy Markdown
Contributor Author

UtmCard.kt — Reusing stats_countries_views_header string

In LoadedContent, the right-aligned column header now directly uses R.string.stats_countries_views_header (line 199):

Text(
    text = stringResource(R.string.stats_countries_views_header),
    ...
)

This string is named after the Locations/Countries card. While the text value is just "Views" and is semantically correct for UTM too, borrowing a country-specific string creates a hidden coupling — if the Locations card ever renames or rephrases that string, the UTM card's header would silently change. A dedicated R.string.stats_utm_views_header (or a more generic R.string.stats_views_column_header) would be safer. That said, since the string value is generic ("Views"), this is a minor concern. Fix this →

StatsCardsConfigurationTest.kt — No explicit assertion on defaultCards() contents

StatsCardsConfigurationTest only checks that the default config's visibleCards equals defaultCards() — it doesn't assert which specific cards are in that list. A regression test that explicitly asserts the 4-card default set would make future changes to defaultCards() more visible and intentional. This is low priority but worth considering.

These suggestions are not applicable

@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
Versionpr22789-f8008a7
Build Number1488
Application IDcom.jetpack.android.prealpha
Commitf8008a7
Installation URL72mr7qdvhcnm8
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 WordPress Android by scanning the QR code below to install the corresponding build.

App NameWordPress Android
Build TypeDebug
Versionpr22789-f8008a7
Build Number1488
Application IDorg.wordpress.android.prealpha
Commitf8008a7
Installation URL6nr5bko5an7a0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@adalpari adalpari marked this pull request as ready for review April 10, 2026 09:21
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 12.50000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.34%. Comparing base (cf81ab8) to head (f8008a7).
⚠️ Report is 3 commits behind head on trunk.

Files with missing lines Patch % Lines
...a/org/wordpress/android/ui/newstats/utm/UtmCard.kt 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #22789      +/-   ##
==========================================
- Coverage   37.34%   37.34%   -0.01%     
==========================================
  Files        2327     2327              
  Lines      124639   124637       -2     
  Branches    16892    16892              
==========================================
- Hits        46551    46547       -4     
- Misses      74351    74353       +2     
  Partials     3737     3737              

☔ View full report in Codecov by Sentry.
📢 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.

@adalpari adalpari requested a review from nbradbury April 10, 2026 09:22
Copy link
Copy Markdown
Contributor

@nbradbury nbradbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! :shipit:

@adalpari adalpari merged commit 9bbf556 into trunk Apr 10, 2026
24 checks passed
@adalpari adalpari deleted the feat/stats-default-cards branch April 10, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants