While implementing the Google Tag Manager v2 for a client site, an interesting form tracking problem was discovered. The contact form was attempting to track submissions via Google Tag Manager, and despite the form submitting properly, it wasn’t being tracked by Google Analytics as a form submit.
It looked like the trigger was firing properly. There were no prohibitive filters to prevent the trigger from firing, so that seemed OK. Was there something different about this form and it’s tag definition? Well, maybe. It was an AJAX form.
AJAX Forms vs Standard Forms
AJAX forms submit differently than standard forms which means there could be an issue with the way Google Tag Manager listens for form submits. AJAX forms are the forms that (as a user submits the form) allow the user to stay on the same page and not require a new page load. Nearly every time an AJAX form submits they also display a simple message like “Thanks, we’ll be in touch” there on the page. Traditional forms take users to a new URL. So, digging deeper into the form trigger, that’s where the issue stood out.
Google Tag Manager’s “Check Validation” was invalidating and interfering with this AJAX form.
After unchecking the “Check Validation” box, and executing a quick “Preview and Debug” in Google Tag Manager, the form was properly tracking on submit.
Sure enough, disabling that checkbox allowed the Form Trigger to intercept the form, and fire the tag.
Why AJAX Forms Don’t Like Google Tag Manager “Check Validation”
A proper “form submit” uses form tags wrapped around the form, and includes a URL to submit the form to. This defined form URL will handle the previous form’s input and then display a thank you page (or refer them to a thank you page).
AJAX forms can operate differently.
A Lesson Learned
If you’re rolling out Google Tag Manager, especially version 2, be aware that some of the tags will operate a little differently. In this case, a valuable lesson was learned – AJAX forms don’t track as submissions in Google Analytics with Google Tag Manager “Check Validation” set to true.