Use Google Tag Manager's form submission trigger to fire a tag when a form has been sent.
To configure a form submission trigger:
- Click Triggers New.
- Click Trigger Configuration and choose the Form Submission trigger type.
The “Wait for Tags” option allows you to delay the form submission until all the tags that depend upon this trigger have fired or the specified timeout has elapsed, whichever comes first. If unselected, slow tags may not fire before the form submit causes the next page to load.
The “Check Validation” option set the trigger to fire only if the form is successfully sent. If unselected, the trigger will fire whenever a user attempts to submit the form.
When a form submission trigger fires, the following built-in variables are populated:
- Form Element: The form element that was clicked.
- Form Classes: An array of the values found in the form's class attribute.
- Form ID: The ID attribute of the form element.
- Form Target: The target attribute of the form element.
- Form URL: The href attribute value of the form element, if any.
- Form Text: The visible text inside the form.