-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
103 lines (71 loc) · 2.41 KB
/
index.html
File metadata and controls
103 lines (71 loc) · 2.41 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Parse Google Analytics Data</title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
</head>
<body>
<form action="/action" method="post" accept-charset="utf-8">
<!--
YOUR FORM FIELDS HERE!!!
-->
<!--Important: list of input fields-->
<input type="hidden" name="medium" id="medium" value="" />
<input type="hidden" name="source" id="source" value="" />
<input type="hidden" name="content" id="content" value="" />
<input type="hidden" name="campaign" id="campaign" value="" />
<input type="hidden" name="term" id="term" value="" />
<input type="hidden" name="adwords_click_id" id="adwords_click_id" value="" />
<input type="hidden" name="total_sessions" id="total_sessions" value="" />
<input type="hidden" name="session_pageviews" id="session_pageviews" value="" />
<input type="hidden" name="first_session" id="first_session" value="" />
<input type="hidden" name="last_session" id="last_session" value="" />
<input type="hidden" name="this_session" id="this_session" value="" />
<button type="submit">Submit</button>
</form>
<script type="text/javascript">
/*
* readCookie function via http://www.quirksmode.org/js/cookies.html
*/
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while(c.charAt(0)==' ') c = c.substring(1,c.length);
if(c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
var utmz = readCookie('__utmz');
if(utmz != null) {
var vals = (function() {
var pairs = utmz.split('.').slice(4).join('.').split('|');
var ga = {};
for(var i = 0; i < pairs.length; i++) {
var temp = pairs[i].split('=');
ga[temp[0]] = temp[1];
}
return ga;
})();
var visits = readCookie('__utma').split('.');
var pageviews = readCookie('__utmb').split('.')[1];
$("#medium").val(vals.utmcmd);
$("#source").val(vals.utmcsr);
$("#content").val(vals.utmcct);
$("#campaign").val(vals.utmccn);
$("#term").val(vals.utmctr);
$("#adwords_click_id").val(vals.utmgclid);
$("#total_sessions").val(visits.pop());
$("#session_pageviews").val(pageviews);
$("#first_session").val(new Date(visits[2]*1000));
$("#last_session").val(new Date(visits[3]*1000));
$("#this_session").val(new Date(visits[4]*1000));
}
</script>
<!--
YOUR GOOGLE ANALYTICS TRACKING SCRIPT HERE
-->
</body>
</html>