Send print parameters to Google Analytics

This commit is contained in:
Ian Gulliver
2018-12-08 06:17:36 +00:00
parent c7a55e5b8f
commit 32d8ba4852

View File

@@ -109,9 +109,16 @@ class PassMate {
let print = this.addElement('button', printStep, 'Click here to print the book!'); let print = this.addElement('button', printStep, 'Click here to print the book!');
print.style.cursor = 'pointer'; print.style.cursor = 'pointer';
printStep.addEventListener('click', () => { printStep.addEventListener('click', () => {
let cls = [];
for (let cl of this.product.classList) {
cls.push(cl);
}
cls.sort();
let gtag = window.gtag || (() => {}); let gtag = window.gtag || (() => {});
gtag('event', 'print', { gtag('event', 'print', {
'event_category': 'Overview', 'event_category': 'Overview',
'event_label': cls.join(' '),
}); });
window.print(); window.print();
}); });