-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormTrackerExample.html
44 lines (42 loc) · 1.34 KB
/
FormTrackerExample.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<html>
<head>
<title>Form Tracker</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<SCRIPT TYPE="text/javascript">
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);
//uncomment below after adding the GA code to the page
//_gaq.push(['_trackEvent', 'Form', 'completed', '"' + array1 + '"']);
});
});
</SCRIPT>
</head>
<body>
<form id="topform" >First Name:
<input type="text" class="form" name="First" id="1">
<br>Last Name:
<input type="text" class="form" name="Last" id="2">
<br>Address:
<input type="text" class="form" name="Address" id="3">
<br>Address 2:
<input type="text" class="form" name="Address2" id="4">
<br>City:
<input type="text" class="form" name="City" id="5">
<br>State:
<input type="text" class="form" name="State" id="6">
<br />Zip:
<input type="text" class="form" name="Zip" id="7">
<br />
<br />
<input type="button" id='submit' name="submit names" value="Submit names">
</form>
</body>
</html>