Are you looking for something? Here is all of the GitHub Docs history in one single commit. Enjoy! 🎉
21 lines
533 B
JavaScript
21 lines
533 B
JavaScript
export default function () {
|
|
const printButton = document.querySelector('.js-print')
|
|
|
|
if (printButton) {
|
|
// Open the print dialog when the button is clicked
|
|
printButton.addEventListener('click', () => {
|
|
window.print()
|
|
})
|
|
}
|
|
|
|
// Track print events
|
|
window.onbeforeprint = function () {
|
|
// Ensure that Google Analytics was registered
|
|
if (!window.ga) return
|
|
const category = 'Print'
|
|
const action = 'print'
|
|
const label = 'print'
|
|
window.ga('send', 'event', category, action, label)
|
|
}
|
|
}
|