forked from robflaherty/scroll-depth
/
index.html
56 lines (50 loc) · 1.68 KB
/
index.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
45
46
47
48
49
50
51
52
53
54
55
56
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery Scroll Depth Test</title>
</head>
<body>
<div id="console" style="background: #aaa; width: 300px; position: fixed; top: 0; right: 0; text-align: center; padding: 20px; line-height: 1; font-family: sans-serif; font-size: 0.2em;"></div>
<h1>jQuery Scroll Depth Test Page</h1>
<div id="top" style="background: #eee; height: 500px">#top</div>
<div id="main" style="background: #ccc; height: 2000px">#main</div>
<footer style="background: #999; height: 200px; display: block;">footer</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="../jquery.scrolldepth.js"></script>
<script>
function log(str) {
if ( typeof console !== 'undefined' && typeof console.log !== 'undefined' ) {
console.log(str);
}
var consoleElement = document.getElementById('console');
consoleElement.innerHTML = str + '<br/>' + consoleElement.innerHTML;
}
var _gaq = {};
_gaq.push = function(data) {
log("_gaq.push(" + JSON.stringify(data) + ");");
};
var dataLayer = {};
dataLayer.push = function(data) {
log("dataLayer.push(" + JSON.stringify(data) + ");");
};
var ga = function(params) {
var args = Array.prototype.slice.call(arguments, 1);
log("ga(" + args.join(',') + ");");
};
_gaq = undefined;
dataLayer = undefined;
//ga = undefined;
$.scrollDepth({
elements: ['#main'],
userTiming: false,
percentage: false,
pixelDepth: false
//gtmOverride: true,
//eventHandler: function(data) {
//log(data)
//}
});
</script>
</body>
</html>