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

View Switcher: Add Tracking and update tab label #61046

Merged
merged 4 commits into from
Mar 4, 2022

Conversation

obenland
Copy link
Member

Also updates the tab label to differ from screen options in wp-admin, so the same UI can be re-used there.

Changes proposed in this Pull Request

  • Bumps stats for when the View tab is opened
  • Bumps stat for when a view is selected.

Testing instructions

  • Navigate to the posts screen for a test site.
  • Open dev tools and select the navigation tab.
  • Click the View tab in the top right of the screen and select a preferred view
  • Verify that g.gif requests are sent for those clicks.
Before After
Screen Shot 2022-02-11 at 12 54 04 PM Screen Shot 2022-02-11 at 12 54 31 PM

There will be a corresponding Jetpack PR that will change the wp-admin version to look the same.

@obenland obenland added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Type] Task [Feature] Calypso & wp-admin Navigation All navigation in Calypso and wp-admin, and the unified transitions between the two. labels Feb 11, 2022
@obenland obenland requested a review from a team February 11, 2022 20:56
@obenland obenland self-assigned this Feb 11, 2022
@obenland
Copy link
Member Author

@ianstewart @olaolusoga I just used bumpStat for now to add counts to an MC stat. Let me know if we need something more sophisticated than that.

@@ -94,7 +97,9 @@ const ScreenOptionsTab = ( { wpAdminPath } ) => {
return (
<div className="screen-options-tab" ref={ ref } data-testid="screen-options-tab">
<button className="screen-options-tab__button" onClick={ handleToggle }>
<span className="screen-options-tab__label">{ __( 'Screen Options' ) }</span>
<span className="screen-options-tab__label">
{ _x( 'View', 'View options to switch between' ) }
Copy link

Choose a reason for hiding this comment

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

ℹ️ String reuse speeds up translation and improves consistency. The following string might make a good alternative and has already been translated 42 times:
translate( 'View', { context: 'Stats: List item action to view content'} ) ES Score: 10
See 1 additional suggestions in the PR translation status page

ℹ️ This context is really long. Are you sure you don't want to use a translator comment instead?

@matticbot
Copy link
Contributor

matticbot commented Feb 11, 2022

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~4159 bytes added 📈 [gzipped])

name                 parsed_size           gzip_size
settings-discussion      +2213 B  (+0.6%)     +556 B  (+0.5%)
people                   +2213 B  (+0.4%)     +691 B  (+0.4%)
pages                    +2213 B  (+0.5%)     +675 B  (+0.5%)
import                   +2213 B  (+0.6%)     +687 B  (+0.6%)
export                   +2213 B  (+0.8%)     +663 B  (+0.7%)
comments                 +2213 B  (+0.3%)     +660 B  (+0.3%)
themes                    +262 B  (+0.0%)      +93 B  (+0.1%)
settings-writing          +262 B  (+0.0%)      +90 B  (+0.0%)
settings                  +262 B  (+0.0%)     +134 B  (+0.1%)
posts-custom              +262 B  (+0.0%)     +171 B  (+0.1%)
posts                     +262 B  (+0.0%)     +171 B  (+0.1%)
media                     +262 B  (+0.0%)     +106 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~55 bytes added 📈 [gzipped])

name                      parsed_size           gzip_size
async-load-design-blocks        -83 B  (-0.0%)      +55 B  (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@obenland obenland added [Status] In Progress and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Feb 11, 2022
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 11, 2022
@obenland
Copy link
Member Author

I just saw that there is tracks tracking on the wp-admin side, so this will have to be updated with that.

@mmtr mmtr removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 14, 2022
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 25, 2022
@@ -86,6 +89,13 @@ const ScreenOptionsTab = ( { wpAdminPath } ) => {
}

const onSwitchView = ( view ) => {
recordTracksEvent( 'wpcom_dashboard_quick_switch_link_clicked', {
Copy link
Member

@mmtr mmtr Feb 28, 2022

Choose a reason for hiding this comment

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

The event is not being tracked right now, I think because this is lacking a dispatch call:

dispatch( recordTracksEvent( 'wpcom_dashboard_quick_switch_link_clicked', { /* ... */ } ) );

@mmtr
Copy link
Member

mmtr commented Feb 28, 2022

Verify that g.gif requests are sent for those clicks.

You can also use the "Vigilante" Chrome extension to debug these events: p7H4VZ-3cB-p2

Also updates the tab label to differ from screen options in wp-admin, so the same UI can be re-used there.
Copy link
Contributor

@Copons Copons left a comment

Choose a reason for hiding this comment

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

LGTM!

Just FYI I couldn't see the g.gif file showing up in my Network tab, but the event seems to be fired correctly when debugging it in console with localStorage.setItem( 'debug', 'calypso:analytics*' );

@obenland obenland merged commit 051e36a into trunk Mar 4, 2022
@obenland obenland deleted the add/view-switch-tracking branch March 4, 2022 19:26
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Mar 4, 2022
@a8ci18n
Copy link

a8ci18n commented Mar 4, 2022

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/7166970

Thank you @obenland for including a screenshot in the description! This is really helpful for our translators.

@inaikem
Copy link
Contributor

inaikem commented Mar 7, 2022

@Automattic/ajax / @ianstewart. This one caught us on the back step! To help make sure we give Happiness, Docs and other teams enough time to prepare for changes like these (even tiny UI/label updates that might seem inconsequential), please be sure to ping me or someone else in the WPcom PA group in future. Thanks! 🙏

@obenland
Copy link
Member Author

obenland commented Mar 7, 2022

@inaikem My apologies, that's on me. Thanks for the reminder, you're absolutely right.

@a8ci18n
Copy link

a8ci18n commented Mar 10, 2022

Translation for this Pull Request has now been finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Calypso & wp-admin Navigation All navigation in Calypso and wp-admin, and the unified transitions between the two. [Type] Task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants