/ Published in: jQuery
Track user interactions with html forms
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var array1 = []; $(document).ready(function () { $('input').change(function () { var formbox = $(this).attr('id'); array1.push(formbox); console.log("you filled out box " + array1); }); $('#submit').click(function () { console.log('tracked ' + array1); //alert('this is the order of boxes you filled out: ' + array1); _gaq.push(['_trackEvent', 'Form', 'completed', '"' + array1 + '"']); }); });
URL: http://jsfiddle.net/nicomiceli/WK5eN/