-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Conversation
@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' ) } |
There was a problem hiding this comment.
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?
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~4159 bytes added 📈 [gzipped])
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])
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. Generated by performance advisor bot at iscalypsofastyet.com. |
I just saw that there is tracks tracking on the wp-admin side, so this will have to be updated with that. |
@@ -86,6 +89,13 @@ const ScreenOptionsTab = ( { wpAdminPath } ) => { | |||
} | |||
|
|||
const onSwitchView = ( view ) => { | |||
recordTracksEvent( 'wpcom_dashboard_quick_switch_link_clicked', { |
There was a problem hiding this comment.
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', { /* ... */ } ) );
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.
3f2a54d
to
184fb0a
Compare
There was a problem hiding this 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*' );
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. |
@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! 🙏 |
@inaikem My apologies, that's on me. Thanks for the reminder, you're absolutely right. |
Translation for this Pull Request has now been finished. |
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
Testing instructions
There will be a corresponding Jetpack PR that will change the wp-admin version to look the same.