-
Notifications
You must be signed in to change notification settings - Fork 4
/
pdf-analytics.js
46 lines (41 loc) · 1.11 KB
/
pdf-analytics.js
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
(function(){
'use strict';
var doc = 'pdfdefault',
download = document.getElementById('download'),
secDownload = document.getElementById('secondaryDownload'),
print = document.getElementById('print'),
secPrint = document.getElementById('secondaryPrint');
if (window.location.search) {
doc = window.location.search.split('=')[1];
}
/**
* Track pagechange
*/
window.addEventListener('pagechange', function pagechange(evt) {
window.trackInteraction(doc, 'page-'+evt.pageNumber);
});
/**
* Track click on download
*/
download.addEventListener('click', function click(evt) {
window.trackInteraction(doc, 'download');
});
/**
* Track click on secDownload
*/
secDownload.addEventListener('click', function click(evt) {
window.trackInteraction(doc, 'download');
});
/**
* Track click on print
*/
print.addEventListener('click', function click(evt) {
window.trackInteraction(doc, 'print');
});
/**
* Track click on secPrint
*/
secPrint.addEventListener('click', function click(evt) {
window.trackInteraction(doc, 'print');
});
})();