Based on work by Simo Ahava: http://www.simoahava.com/analytics/track-form-abandonment-with-google-tag-manager/
This script will automatically track all forms on your pages. When a user changes input values on a form, it will be tracked unless the form is the one being submitted. Form and input 'name' attributes are used by default.
See index.html for an example.
- Add form submit trigger in GTM (either on all forms or the subset you want to track)
- Add trigger for custom event 'formAbandonment'
- Add data layer variables 'eventAction' and 'eventCategory'
- Add tag to trigger a GA event on formAbandonment trigger with event category and action taken from data layer variables
- Include auto-ga-form-abandonment.js script
- Observe form abandonment events in GA!