Multi-Step form only captures the last step

gerard_reyes Posted by: Gerard Reyes Date Posted: December 12, 2024
Back to Case Studies

Issue

The form is a multi-step form. The lead captured is only from the last step. We are missing data from the first part of the form.

Solution

I added a trigger to fire the MCFX capture for other pages besides the last page. This results in a lead even on the first page, then it will be updated as you proceed with the multi-step form.

<script>

document.addEventListener('click', function(event) {
     if (
         event.target.tagName === 'BUTTON' &&
         event.target.type === 'button' &&
         event.target.id.startsWith('gform_next_button') &&
         event.target.closest('form') &&
         event.target.closest('form').id === 'gform_1'
     ) {
         console.log('This is a next button inside form gform_1!');
         var my_form = event.target.closest('form');
         mcfx('capture', my_form);
         console.log('MCFX capture success');
     }
});

</script>

Achievement

Lead is captured.

Snippet/Screenshot/Link