-
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
Logged-in Performance Profiler:Add additional track events #95636
base: trunk
Are you sure you want to change the base?
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~192 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. 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. |
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
@@ -0,0 +1,2 @@ | |||
export const profilerVersion = () => | |||
window.location.pathname.includes( '/sites/performance/' ) ? 'logged-in' : 'logged-out'; |
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.
If we ever changed the the page URLs and forgot to update this function we wouldn't want to inadvertently record data that looks correct but is actually bogus. It ruin all the stats up till the point we discovered the issue. Same thing for if we ever added this component to a whole other page.
I think it's better not to assume that there's only two possible profiler versions.
window.location.pathname.includes( '/sites/performance/' ) ? 'logged-in' : 'logged-out'; | |
if ( window.location.pathname.includes( '/sites/performance/' ) ) { | |
return 'logged-in'; | |
} else if ( window.location.pathname.includes( '/speed-test-tool' ) ) { | |
return 'logged-out'; | |
} | |
return 'unknown'; |
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.
That is true, best to be exhaustive with the expected options here.
@@ -39,6 +41,12 @@ export const StatusSection = ( props: StatusSectionProps ) => { | |||
good: translate( 'Excellent' ), | |||
}[ status ]; | |||
|
|||
const recordRecommendationsClickEvent = ( filter = 'all' ) => |
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.
Maybe this is just a personal preference thing, but a required function argument feels better here. The function caller knows best which filter is active when it's clicked.
const recordRecommendationsClickEvent = ( filter = 'all' ) => | |
const recordRecommendationsClickEvent = ( filter: string ) => |
@@ -300,7 +302,9 @@ export const SitePerformance = () => { | |||
disabled={ disableControls } | |||
onChange={ ( page_id ) => { | |||
const url = new URL( window.location.href ); | |||
|
|||
recordTracksEvent( 'calypso_performance_profiler_page_selector_change', { | |||
page: pages.find( ( page ) => page.value === page_id )?.label ?? '/', |
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.
How useful is it to record the page title? It's not really aggregatable data.
I feel like a is_home
event prop would make more sense than the raw page title which we can't really do anything with in the tracks tool.
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.
And I think we should add the version
prop here too.
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.
I was recording the page_id
at first but that didn't seem to be useful either.
Related to https://github.com/Automattic/dotcom-forge/issues/9065
Proposed Changes
This relates to this comment pdKhl6-4fl-p2#comment-7548
Why are these changes being made?
Testing Instructions
localStorage.setItem( 'debug', 'calypso:analytics*' );
Pre-merge Checklist