Skip to content

(via Mercy811): Wrap shouldTrackSubmit callback in try-catch to prevent submit handler c#1507

Closed
macroscopeapp[bot] wants to merge 1 commit intoAMP-147416-form-submissions-fired-on-empty-form-submissionfrom
macroscope/AMP-147416-form-submissions-fired-on-empty-form-submission
Closed

(via Mercy811): Wrap shouldTrackSubmit callback in try-catch to prevent submit handler c#1507
macroscopeapp[bot] wants to merge 1 commit intoAMP-147416-form-submissions-fired-on-empty-form-submissionfrom
macroscope/AMP-147416-form-submissions-fired-on-empty-form-submission

Conversation

@macroscopeapp
Copy link
Copy Markdown
Contributor

@macroscopeapp macroscopeapp Bot commented Jan 23, 2026

Macroscope: Fix It For Me

Activity

Currently: Closed by Mercy811

Previously
  • Action failed: Semantic PR Check
  • Waiting on checks
  • Pushed 33f53b7

Wrap packages.analytics-browser.plugins.form-interaction-tracking.initializeFormTracking submit handler shouldTrackSubmit callback in try-catch to log warnings and continue tracking on exceptions

Add a try/catch around formInteractionsConfig.shouldTrackSubmit(event) in the submit handler of initializeFormTracking to warn via config.loggerProvider.warn on thrown errors and proceed to track the default submit event.

📍Where to Start

Start with the submit handler in initializeFormTracking in form-interaction-tracking.ts.


Macroscope summarized 33f53b7.


Note

Improves resiliency of form submit tracking.

  • Wraps shouldTrackSubmit callback in a try/catch within form-interaction-tracking.ts; on exception, logs a warning and defaults to tracking form_submit
  • Retains existing behavior when callback returns false (skips tracking) and when callback is invalid or event isn’t a SubmitEvent (logs and proceeds)

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

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