Skip to content

Conversation

@rachelmcr
Copy link
Contributor

@rachelmcr rachelmcr commented Dec 15, 2022

Closes: #8173
⚠️ Depends on #8424 ⚠️

Description

This PR updates the My Store dashboard to use site summary stats (SiteSummaryStats) for the "Visitors" and "Conversion" stats for the selected period.

Why we need this:

  • Right now, we're computing a site's total visitor count for the entire period by adding together the visitor count for each of the intervals within the period (from SiteVisitStats data).
  • What we should do in the dashboard — and we're doing already in Analytics Hub — is get the total visitor count for the entire period from SiteSummaryStats data. We should continue to get the visitor count for specific intervals from SiteVisitStats, to show when an interval is selected in the stats chart.

Note: We should remove the inaccurate totalVisitors computed property from SiteVisitStats. However, while making these changes I discovered we're also using this property in the store info widget. I've opened #8426 to track that.

Changes

  • Updates the StatsDataTextFormatter to have separate methods for getting the visitor count text using SiteVisitStats (for a single interval) or using SiteSummaryStats (for the entire period). Also removes an unused method.
  • Updates StoreStatsPeriodViewModel to fetch the SiteSummaryStats from storage for the selected time period, and to use those stats for the visitor and conversion text unless a specific interval is selected.
  • Updates and adds relevant unit tests.

Testing instructions

  1. Build and run the app.
  2. Confirm the "Visitors" and "Conversion" stats load on the My Store dashboard.
  3. Confirm you can select a specific interval in the stats chart and the "Visitors" and "Conversion" stats update to reflect the selected interval.
  4. Select a different period (Today, This Week, This Month, This Year) and confirm the "Visitors" and "Conversion" stats load as expected for that period.
  5. Tap "See more" and confirm the "Conversion" stat on My Store matches the "Conversion Rate" stats in the Sessions card in Analytics.

Screenshots

/ Dashboard Analytics
Before before-dashboard before-analytics
After after-dashboard after-analytics

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@rachelmcr rachelmcr added the feature: stats Related to stats, including Top Performers. label Dec 15, 2022
@rachelmcr rachelmcr added this to the 11.7 milestone Dec 15, 2022
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 15, 2022

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr8427-8ad0ff4 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@rachelmcr
Copy link
Contributor Author

There's a failing unit test that is passing for me locally. I'll take a closer look to get that fixed!

@ealeksandrov ealeksandrov self-assigned this Dec 16, 2022
Copy link
Contributor

@ealeksandrov ealeksandrov left a comment

Choose a reason for hiding this comment

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

Thanks for fixing visitors logic on the dashboard! :shipit:

@ealeksandrov ealeksandrov removed their assignment Dec 16, 2022
Base automatically changed from issue/8173-sitesummarystats-dashboard-sync to trunk December 16, 2022 11:29
@peril-woocommerce
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 2 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

@rachelmcr rachelmcr enabled auto-merge December 16, 2022 11:41
@rachelmcr rachelmcr merged commit d71c1cf into trunk Dec 16, 2022
@rachelmcr rachelmcr deleted the issue/8173-sitesummarystats-dashboard-display branch December 16, 2022 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: stats Related to stats, including Top Performers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stats: Adding all visitors from SiteVisitStats can create inaccurate total visitor count

4 participants