This repository has been archived by the owner on Apr 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
63 lines (51 loc) · 1.84 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
57
58
59
60
61
62
63
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ElasticEvent Tracker</title>
<meta name="description" content="ElasticEvent Tracker">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" media="screen" href="track-style.css">
</head>
<body>
<canvas id="canvas"></canvas>
<span id="session-id"></span>
<span id="instructions">Smile! Your mouse position and clicks are being tracked.</span>
<script src="../../dist/elastic-event.min.js"></script>
<script src="../../node_modules/bodybuilder/browser/bodybuilder.min.js"></script>
<script src="track-mouse.js"></script>
<script src="draw-mouse.js"></script>
<script src="query-mouse.js"></script>
<script>
var elasticevent = new ElasticEvent({
host: 'https://logsene-receiver.sematext.com',
index: '8653e58f-6a84-4839-8541-df3f316111cc',
setupIntervalSend: true,
setupBeforeUnload: true
});
// extend base event
var base = elasticevent.baseEvent;
elasticevent.baseEvent = function () {
var baseEvent = base.apply(this, arguments);
baseEvent['@timestamp'] = new Date().toISOString();
return baseEvent;
};
var sessionId = new Date().getTime().toString() +
'-xxxxxx'.replace(/x/g, function() {
return (Math.random()*16|0).toString(16)
});
var canvas = document.getElementById('canvas');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var sessionIdElement = document.getElementById('session-id');
sessionIdElement.textContent = sessionId;
// identify current session
elasticevent.identify({
sessionId: sessionId
});
drawmouse();
trackmouse(elasticevent);
querymouse(elasticevent, Bodybuilder)
</script>
</body>
</html>