Return to Snippet

Revision: 65059
at October 18, 2013 04:27 by nicom


Initial Code
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 + '"']);
    });
});

Initial URL
http://jsfiddle.net/nicomiceli/WK5eN/

Initial Description
Track user interactions with html forms

Initial Title
Form tracking with JS and Google Analytics

Initial Tags
javascript, jquery

Initial Language
jQuery