Gtm.form submit firing when the form has not been submitted


Hi,

As per screenshot, I’ve noticed that the gtm.formsubmit fires when the form has not actually been submitted because of a validation error. So you end up with 2-3 gtm.formsubmits for each actual case.

How can I stop this from happening without having to run a whole other set of validations within GTM?

Thanks

James


10 replies

Userlevel 7
Badge +4

Hi James,

Are you using the “Form Submission” trigger?

Try Custom Event instead with event name “gtm.formSubmit”

Hi Stefano,

No I’m not, I’m using the Custom Event with event name “gtm.formSubmit” as suggested in your guide. I know that the standard Form Submission has a “Check for validations” before firing but i don’t know how to set that up with the Custom Event.

Thanks

James

Hi Stefano, do you know how I can solve this?

Userlevel 7
Badge +4

Hi James,

Sorry for the delay here. Could you share some additional information in regards to the form and set up?

Are you using the integration for GTM or did you enter the GTM container manually? Is this form in a lightbox? Have you checked off the email validation in your UB form?

If you can send over some screenshots of your set up in GTM and URL we’ll be able to diagnose a little better.

Cheers!

Thanks,

I’m using your script manager, as per the guide. No it’s not from a lightbox, yes there is an email validation on the UB form.

https://discover.octopuswealth.com/retirement-guide-form-over/

Would tying into the afterFormSubmit ensure validation was successful for this purpose? If so maybe you could push a custom event and use this as your trigger? I may be barking up the wrong tree here but I would try something along the lines of the following:

<script>
(function() {
        window.ub.hooks.afterFormSubmit.push(function() {
         window.dataLayer = window.dataLayer || [];
           window.dataLayer.push({
             event: 'ubForm'
           })
         })
})();
</script>

And then see if ubForm event is passed in preview only on successful validation or every time.

Hi Stefano,

Would this be the correct thing to do ?

Userlevel 7
Badge +4

Would it be possible to get access to GTM? I’ll send over my email through DM.

Userlevel 7
Badge +4

Hi James!

I think this issue was resolved finally?

Let me know!

Hey Stefano - did you or Jamessha ever figure this out? I am running into the same issue. We saw 1,000 form submission events in GTM for about 100 actual forms being submitted. Its really messing up our tracking.

Thanks!

Reply