Skip to content

Amp 149661 form abandoned#1563

Draft
daniel-graham-amplitude wants to merge 7 commits intomainfrom
AMP-149661-form-abandoned
Draft

Amp 149661 form abandoned#1563
daniel-graham-amplitude wants to merge 7 commits intomainfrom
AMP-149661-form-abandoned

Conversation

@daniel-graham-amplitude
Copy link
Collaborator

@daniel-graham-amplitude daniel-graham-amplitude commented Feb 27, 2026

Summary

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?:

Note

Medium Risk
Adds new form-abandonment autocapture that attaches pagehide/beforeunload listeners and emits a new event, which could change event volume/behavior in production if enabled. Moderate risk due to new global listeners and new tracking path, but it is gated by shouldTrackAbandoned.

Overview
Adds a new optional autocapture event, [Amplitude] Form Abandoned, emitted when a started form is left without submission (triggered via pagehide/beforeunload) and exposed via the new formInteractions.shouldTrackAbandoned config.

Updates the form interaction tracking plugin to register/remove window-level listeners and track abandonment once per started form, and extends coverage with new Jest tests plus a Playwright e2e page/spec for form-interactions.

Written by Cursor Bugbot for commit 4829e1c. This will update automatically on new commits. Configure here.

@daniel-graham-amplitude daniel-graham-amplitude marked this pull request as draft February 27, 2026 23:26
@daniel-graham-amplitude
Copy link
Collaborator Author

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

}
// left the page indicating
hasFormChanged = false;
};
Copy link

Choose a reason for hiding this comment

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

hasFormAbandoned never resets, blocking repeated abandon tracking

Medium Severity

hasFormAbandoned is set to true in trackFormAbandoned but is never reset to false. After an abandon event fires (e.g., beforeunload that gets canceled by another handler, or pagehide when the page enters bfcache and is later restored), the flag permanently prevents any future Form Abandoned events. Meanwhile, hasFormChanged is reset to false, so a subsequent form change triggers a new Form Started event — creating an asymmetry where forms can be "started" multiple times but only "abandoned" once. The change handler needs to reset hasFormAbandoned when re-engaging with the form.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant