1document.addEventListener('DOMContentLoaded', function() { 2 // Check if Matomo tracker is loaded 3 if (typeof _paq !== 'undefined') { 4 // Track the scroll depth in 10% steps 5 var previousPercentage = -10; 6 7 function trackScrollDepth() { 8 var scrollHeight = document.documentElement.scrollHeight; 9 var clientHeight = window.innerHeight; 10 var scrollTop = window.pageYOffset || document.documentElement.scrollTop; 11 var percentScrolled = ((scrollTop + clientHeight) / scrollHeight) * 100; 12 var viewedPercentage = Math.floor(percentScrolled / 10) * 10; 13 14 // Check if a new 10% step is reached 15 if (viewedPercentage > previousPercentage) { 16 // Send Matomo event for the reached scroll depth 17 _paq.push(['trackEvent', 'Scroll depth', viewedPercentage + '%']); 18 19 previousPercentage = viewedPercentage; 20 } 21 } 22 23 // Track the scroll depth on scroll event 24 window.addEventListener('scroll', trackScrollDepth); 25 } 26 });
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.