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

Stats: Add modal close event for form submission #94574

Merged
merged 2 commits into from
Sep 20, 2024

Conversation

dognose24
Copy link
Contributor

Related to #94553 (review)

Proposed Changes

  • Add the modal close event for form submission: stats_feedback_action_close_form_modal_after_submission.

Why are these changes being made?

  • Add a more dedicated tracking event.

Testing Instructions

  • Spin this change with the Calypso Live branch.
  • Navigate to Stats > Traffic page with sites having a Stats commercial license.
  • Scroll down to the bottom of the page.
  • Click on the Not a fan? Help us improve button.
  • Submit the feedback from.
  • Ensure the tracking event is sent with stats_feedback_action_close_form_modal_after_submission.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@dognose24 dognose24 added the Stats Everything related to our analytics product at /stats/ label Sep 16, 2024
@dognose24 dognose24 requested review from a8ck3n and a team September 16, 2024 08:13
@dognose24 dognose24 self-assigned this Sep 16, 2024
@matticbot matticbot added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Sep 16, 2024
@matticbot
Copy link
Contributor

matticbot commented Sep 16, 2024

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications
  • odyssey-stats
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/add_modal_close_event_after_submission on your sandbox.

@matticbot
Copy link
Contributor

matticbot commented Sep 16, 2024

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

Sections (~21 bytes added 📈 [gzipped])

name   parsed_size           gzip_size
stats        +34 B  (+0.0%)      +21 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.

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.

Copy link
Contributor

@a8ck3n a8ck3n left a 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' );
}
Copy link
Contributor

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 ) => {
Copy link
Contributor

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.

@dognose24
Copy link
Contributor Author

Only the stats_feedback_action_directly_close_form_modal event is introduced to analyze the path between closing the modal and submitting the form.

@dognose24 dognose24 merged commit ff7cc13 into trunk Sep 20, 2024
11 checks passed
@dognose24 dognose24 deleted the update/add_modal_close_event_after_submission branch September 20, 2024 21:09
@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 Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stats Everything related to our analytics product at /stats/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants