-
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
Stats: Add modal close event for form submission #94574
Stats: Add modal close event for form submission #94574
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
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 |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~21 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. |
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.
This tests well. I have some minor feedback but no blockers.
I'm not sure if we really need to push this back up to the caller. In the same way we track the submission event inside the modal, we could probably track the dismissal here too. It's not the closing of the modal that we want to track (lifecycle event) but the user intention (providing feedback vs dismissing the modal).
We could base this on the isSubmissionSuccessful
value which would be false
if the user dismissed the modal but it would probably make sense to add state for a submission attempt.
One other thing I noticed here is that we might have a bug in the case of a failed network request. In that case, the modal will stay on screen without any user feedback…I think. I think we just want to move the call to handleClose()
outside the if
block for this one.
trackStatsAnalyticsEvent( 'stats_feedback_action_close_form_modal_after_submission' ); | ||
} else { | ||
trackStatsAnalyticsEvent( 'stats_feedback_action_close_form_modal' ); | ||
} |
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'm not sure we need these for analytics. It might be cleaner to remove this handler and just track dismiss vs submit in the modal. What do you think?
}, 200 ); | ||
}, [ onClose ] ); | ||
const handleClose = useCallback( | ||
( isAfterSubmission: boolean ) => { |
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 think we could just track the analytics event here based on either isSubmissionSuccessful
(or a new bit of state like didAttemptSubmission
) instead of pushing this back up to the caller.
Only the |
Related to #94553 (review)
Proposed Changes
stats_feedback_action_close_form_modal_after_submission
.Why are these changes being made?
Testing Instructions
Not a fan? Help us improve
button.stats_feedback_action_close_form_modal_after_submission
.Pre-merge Checklist