Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update stats analytics #20194

Merged
merged 17 commits into from
Feb 19, 2024
Merged

Update stats analytics #20194

merged 17 commits into from
Feb 19, 2024

Conversation

irfano
Copy link
Member

@irfano irfano commented Feb 15, 2024

Fixes #20176

This updates analytics events related to the stats screen.

Event Description
stats_insights_accessed [FIXED] After opening the stats screen, this was always being tracked; even the insights tab was not selected. This fixes it and tracks the correct event.
stats_period_accessed will be tracked when the TRAFFIC tab is shown. This event was including both granularity and period properties with the same value. Now it will include only "period".
stats_previous_date_tapped stats_previous_date_tapped renamed to stats_date_tapped_backward to match with iOS. Before it was sending null period, it has been fixed.
stats_next_date_tapped stats_next_date_tapped renamed to stats_date_tapped_forward to match with iOS. Before it was sending null period, it has been fixed.
tap_source property that has been added to stats_accesed event Description
quick_actions opening stats from My Site
row opening stats from My Site → More
today_stats_card opening stats from "Today's Stats" card on "My Site"
notification opening stats from a notification
link opening stats from a deeplink
shortcut opening stats from shortcut
activity_log opening stats from Activity Log screen
jetpack_connection opening stats after connecting Jetpack
widget opening stats from widgets

To Test:

Test these for both disabled and enabled stats_traffic_tab flag. The flag can be set from "Me → Debug Settings".

stats_insights_accessed

  1. Log in.
  2. Open stats from My Site.
  3. If the INSIGTHS tab is selected, verify that the 🔵 Tracked: stats_insights_accessed is logged.
  4. Change the tab and relesect INSIGHTS tab.
  5. Verify that the 🔵 Tracked: stats_insights_accessed is logged again.

stats_period_accessed

  1. Log in.
  2. Ensure the stats_traffic_tab is disabled.
  3. Open stats from My Site.
  4. Verify that when DAYS tab is selected, 🔵 Tracked: stats_period_accessed, Properties: {"period":"days"} is logged.
  5. Select other granular tabs and verify that period property is updated properly.
  6. Enable stats_traffic_tab flag.
  7. Open stats from My Site.
  8. Verify that when TRAFFIC tab is selected, 🔵 Tracked: stats_period_accessed, Properties: {"period":"days"} is logged.

stats_previous_date_tapped, stats_next_date_tapped

  1. Log in.
  2. Ensure the flag is disabled.
  3. Open stats from My Site.
  4. Select DAYS, WEEKS, MONTHS or YEARS tab.
  5. Change the selected date to the previous date with arrows.
  6. Verify that 🔵 Tracked: stats_date_tapped_backward, Properties: {"period":"days"} is logged with the proper period.
  7. Change the selected granularity and repeat 6.
  8. Change the selected date to the next date with arrows.
  9. Verify that 🔵 Tracked: stats_date_tapped_forward, Properties: {"period":"days"} is logged with the proper period.
  10. Change the selected granularity and repeat 9.
    11. Disable the feature flag.
  11. Open stats from My Site.
  12. Select the TRAFFIC tab.
  13. Repeat 5-6-7-8-9-10.

quick_actions

  1. Log in.
  2. Open stats from My Site.
  3. Verify that 🔵 Tracked: stats_accessed, Properties: {"tap_source":"quick_actions",...} is logged.

row

  1. Log in.
  2. Open stats from My Site → More.
  3. Verify that 🔵 Tracked: stats_accessed, Properties: {"tap_source":"row",...} is logged.

today_stats_card

  1. Log in.
  2. Open stats from "Today's Stats" card on "My Site".
  3. Verify that 🔵 Tracked: stats_accessed, Properties: {"tap_source":"today_stats_card",...} is logged.

notification
You need to use debug build to test this or wait Monday for weekly roundup notification.

  1. Log in.
  2. Ensure notification permission is allowed.
  3. Open Me → Debug settings.
  4. Tap the menu button at the top right.
  5. Tap "Force show Weekly Roundup notification" button.
  6. Wait for a while, ~30 seconds.
  7. Tap the Weekly Roundup notification received.
  8. Verify that 🔵 Tracked: stats_accessed, Properties: {"tap_source":"notification",...} is logged.

link
If you know an easier way to test a deeplink, you can use it.

  1. Log in.
  2. Open internet browser on the device and open any online HTML editor that you can compile the HTML code.
  3. Type this code into HTML editor:
<html>
<p>Test <a href="jetpack://stats">jetpack://stats</a> deeplink</p>
</html>
  1. After running the code, tap the jetpack://stats link.
  2. Verify that the stats screen is opened and 🔵 Tracked: stats_accessed, Properties: {"tap_source":"link",...} is logged.

shortcut

  1. Log in.
  2. Open the device's home screen.
  3. Long tap on the app icon.
  4. From the shortcut menu, tap Stats.
  5. Verify that the stats screen is opened and 🔵 Tracked: stats_accessed, Properties: {"tap_source":"shortcut",...} is logged.

jetpack_connection

  1. Log in with a self-hosted site that is not connected to the Jetpack.
  2. Open Stats from any point, e.g. "My Site →Stats".
  3. You will see the INSTALL JETPACK screen instead of the stats.
  4. Tap INSTALL JETPACK and complete the flow.
  5. The stats screen should be shown at the end of the flow.
  6. Verify that 🔵 Tracked: stats_accessed, Properties: {"tap_source":"jetpack_connection",...} is logged.

activity_log
I couldn't find a way to test this. Please let me know if you can test it. I'm also pretty sure this PR will track the activity_log property properly.


Regression Notes

  1. Potential unintended areas of impact

    • N/A
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

    • N/A
  3. What automated tests I added (or what prevented me from doing so)

    • Updated current unit tests

PR Submission Checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing Checklist:

  • WordPress.com sites and self-hosted Jetpack sites.
  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • Talkback.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • Large and small screen sizes. (Tablet and smaller phones)
  • Multi-tasking: Split screen and Pop-up view. (Android 10 or higher)

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 15, 2024

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr20194-02869c6
Commit02869c6
Direct Downloadjetpack-prototype-build-pr20194-02869c6.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Feb 15, 2024

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr20194-02869c6
Commit02869c6
Direct Downloadwordpress-prototype-build-pr20194-02869c6.apk
Note: Google Login is not supported on these builds.

Copy link

codecov bot commented Feb 15, 2024

Codecov Report

Attention: 40 lines in your changes are missing coverage. Please review.

Comparison is base (333c1c7) 40.17% compared to head (02869c6) 40.18%.
Report is 21 commits behind head on trunk.

Files Patch % Lines
...rdpress/android/ui/stats/refresh/StatsViewModel.kt 66.66% 8 Missing and 3 partials ⚠️
...ava/org/wordpress/android/ui/ActivityLauncher.java 0.00% 8 Missing ⚠️
...ordpress/android/ui/deeplinks/DeepLinkNavigator.kt 0.00% 6 Missing ⚠️
...droid/ui/stats/refresh/lists/StatsListViewModel.kt 0.00% 4 Missing ⚠️
...sh/lists/sections/granular/SelectedDateProvider.kt 0.00% 2 Missing ⚠️
...a/org/wordpress/android/ui/ShortcutsNavigator.java 0.00% 1 Missing ⚠️
...ifications/utils/FormattableContentClickHandler.kt 0.00% 1 Missing ⚠️
...ts/refresh/lists/widget/WidgetBlockListProvider.kt 0.00% 1 Missing ⚠️
.../lists/widget/alltime/AllTimeWidgetListProvider.kt 0.00% 1 Missing ⚠️
...resh/lists/widget/today/TodayWidgetListProvider.kt 0.00% 1 Missing ⚠️
... and 4 more
Additional details and impacted files
@@           Coverage Diff           @@
##            trunk   #20194   +/-   ##
=======================================
  Coverage   40.17%   40.18%           
=======================================
  Files        1469     1469           
  Lines       67634    67668   +34     
  Branches    11202    11208    +6     
=======================================
+ Hits        27174    27193   +19     
- Misses      37968    37981   +13     
- Partials     2492     2494    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@irfano irfano force-pushed the update-stats-analytics branch from 02885cc to fdd2968 Compare February 17, 2024 11:23
@irfano irfano requested a review from ravishanker February 18, 2024 17:02
@irfano irfano marked this pull request as ready for review February 18, 2024 17:02
@irfano irfano force-pushed the update-stats-analytics branch from a22b094 to 02869c6 Compare February 18, 2024 21:46
@ravishanker
Copy link
Contributor

ravishanker commented Feb 18, 2024

stats_date_tapped_backward renamed to stats_previous_date_tapped to match with iOS.
stats_date_tapped_forward renamed to stats_next_date_tapped to match with iOS

It is still showing...backward, and forward, instead of previous_date, and next_date. Test instructions also differ from what is stated in Description about renaming.

🔵 Tracked: stats_date_tapped_backward, Properties: {"period":"days"}
🔵 Tracked: stats_date_tapped_forward, Properties: {"period":"weeks"}

@ravishanker ravishanker modified the milestones: 24.3, 24.4 Feb 18, 2024
@ravishanker
Copy link
Contributor

ravishanker commented Feb 19, 2024

stats_date_tapped_backward renamed to stats_previous_date_tapped to match with iOS.
stats_date_tapped_forward renamed to stats_next_date_tapped to match with iOS

It is still showing...backward, and forward, instead of previous_date, and next_date. Test instructions also differ from what is stated in Description about renaming.

🔵 Tracked: stats_date_tapped_backward, Properties: {"period":"days"} 🔵 Tracked: stats_date_tapped_forward, Properties: {"period":"weeks"}

Actually, the description is wrong implementation d4231a1 is correct!

Copy link
Contributor

@ravishanker ravishanker left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@ravishanker ravishanker modified the milestones: 24.4, 24.3 Feb 19, 2024
@ravishanker ravishanker merged commit 643656f into trunk Feb 19, 2024
21 of 23 checks passed
@ravishanker ravishanker deleted the update-stats-analytics branch February 19, 2024 00:51
@irfano
Copy link
Member Author

irfano commented Feb 19, 2024

Actually, the description is wrong implementation d4231a1 is correct!

Thank you for noticing. I have corrected the description.

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.

Add or update analytics
4 participants