Form submission trigger > Check validation


On my website. I have a form.

  • If the user fills properly and send the form, he receives a thank-you message.
  • If the user doesn’t fill properly and send the form, he receives an error message.
  • In both cases, we do not change the URL. We stay on the same page.

I would like to trigger two tags:

  • One when the form is properly filled and sent.
  • One when the form is not properly filled and doesn’t send.

I tested the form submission trigger, but in all cases, my tags are triggered, there is no validation check (like in GTM).

How can I put this tracking in place?

Many thanks,

Hi @ValPiwik,

The form submit trigger fires on all submit events. This means that even when the form has errors it still sends the submit event (in your case). In this case I would recommend to implement dataLayer events with validation so that you send an event to the dataLayer whenever the form is sent or is not filled properly (gives errors). You can then create events which you need and set them on the dataLayer trigger.

Have a great day! :slight_smile: