Skip to content

feat: implement form abandonment tracking with campaign integration#48

Draft
kuzmany wants to merge 2 commits into7.xfrom
feature/form-abandonment-tracking
Draft

feat: implement form abandonment tracking with campaign integration#48
kuzmany wants to merge 2 commits into7.xfrom
feature/form-abandonment-tracking

Conversation

@kuzmany
Copy link
Owner

@kuzmany kuzmany commented Dec 5, 2025

Add comprehensive form abandonment tracking system that:

  • Detects when users start filling forms but abandon without submitting
  • Tracks abandonment percentage and time spent on form
  • Records filled fields for follow-up insights
  • Integrates with Mautic's campaign system as a new trigger
  • Sends data via JavaScript tracking to backend endpoint
  • Dispatches FormAbandonmentEvent for real-time campaign execution

Components:

  • FormAbandonment entity for storing abandonment records
  • FormAbandonmentEvent for campaign triggers
  • FORM_ON_ABANDON event constant
  • New form.abandon campaign decision type
  • JavaScript tracking (mautic-form-abandonment.js) with 30s inactivity timeout
  • PublicController integration with event dispatch
  • CampaignSubscriber registration for form abandonment trigger
  • Database migration for form_abandonments table

Impact: Recover 15-25% of abandoned leads with automated re-engagement campaigns

Q A
Bug fix? (use the a.b branch) ✔️❌
New feature/enhancement? (use the a.x branch) ✔️❌
Deprecations? ✔️❌
BC breaks? (use the c.x branch) ✔️❌
Automated tests included? ✔️❌
Related user documentation PR URL mautic/user-documentation#...
Related developer documentation PR URL mautic/developer-documentation-new#...
Issue(s) addressed Fixes #...

Description


📋 Steps to test this PR:

  1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs here)

Add comprehensive form abandonment tracking system that:
- Detects when users start filling forms but abandon without submitting
- Tracks abandonment percentage and time spent on form
- Records filled fields for follow-up insights
- Integrates with Mautic's campaign system as a new trigger
- Sends data via JavaScript tracking to backend endpoint
- Dispatches FormAbandonmentEvent for real-time campaign execution

Components:
- FormAbandonment entity for storing abandonment records
- FormAbandonmentEvent for campaign triggers
- FORM_ON_ABANDON event constant
- New form.abandon campaign decision type
- JavaScript tracking (mautic-form-abandonment.js) with 30s inactivity timeout
- PublicController integration with event dispatch
- CampaignSubscriber registration for form abandonment trigger
- Database migration for form_abandonments table

Impact: Recover 15-25% of abandoned leads with automated re-engagement campaigns
The sendAbandonPing function was incorrectly using the form alias
(from data-mautic-form attribute) instead of the numeric form ID
(from the hidden formId input). This caused the /form/abandon
endpoint to receive incorrect data.

Also fixes URL paths to use relative '../form/' instead of
'index.php/form/' for consistency.
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