From https://github.com/lunametrics/form-tracker/blob/master/form-tracker.js