• Internet Marketing
    • Google Analytics
    • Google Tag Manager
    • SEO
    • Content
    • Marketing Automation
    • Social Media
    • PPC
  • Technology
    • Mobile
    • ISP
    • Hosting
    • Tools & Services
  • Resources
    • Useful And Unique Sites
    • Google Analytics Referral Spam Filters
    • Google Analytics URL Builder for Custom UTM Codes
  • Contact
www.gregcruce.com
  • Internet Marketing
    • Google Analytics
    • Google Tag Manager
    • SEO
    • Content
    • Marketing Automation
    • Social Media
    • PPC
  • Technology
    • Mobile
    • ISP
    • Hosting
    • Tools & Services
  • Resources
    • Useful And Unique Sites
    • Google Analytics Referral Spam Filters
    • Google Analytics URL Builder for Custom UTM Codes
  • Contact
07 August 2017

GTM AJAX Forms

Written by Greg Cruce
Google Tag Manager Leave a Comment
Share

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.

GTM AJAX Forms

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.

GTM AJAX Forms Trigger

After unchecking the “Check Validation” box, and executing a quick “Preview and Debug” in Google Tag Manager, the form was properly tracking on submit.

GTM AJAX Forms Debug & Publish

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.

Instead of the HTML page sending the content over, AJAX forms use Javascript to “scrape” the user-entered content of a form, and put it into an in-memory object.  Behind the scenes (and without proper “form submit” technology), AJAX will “push” the content to another page and usually get back a simple yes or no response.  This “scrape and submit” trips up the “Check Validation” option, since it didn’t see a true form submission.

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.

Join other digital marketers who have a head start

Free online marketing tips and resources delivered to your inbox

No charge. Unsubscribe anytime

ajax, form
Greg Cruce

Greg has over 20 years of combined experience in the disciplines of web development, computer programming, IT, and Internet marketing and strategy. This unique skillset allows for powerful insights from consulting, strategy, execution and analysis.

Leave a Reply

Cancel reply

www.gregcruce.com

The professional blog by Greg Cruce, an Internet and Digital Marketing professional.

  • About Me
  • Subscribe to RSS
  • Connect via LinkedIn
  • Connect via Twitter

Posts

  • 7 Tips For Writing For The Web
  • 6 Metrics To Watch In Google Analytics
  • The In-Depth Guide To Reduce And Improve Bounce Rate For Your Website Or Blog
    The In-Depth Guide To Reduce And Improve Bounce Rate For Your Website Or Blog

Services

  • Google Analytics Consulting
copyright www.gregcruce.com