1jQuery(window).on("load", function(){ 2 3 console.log('Initalise downloading tracking...'); 4 const currentResource = new RegExp(location.host); 5 const webAnchor = new RegExp("#+"); 6 const codeLinks = new RegExp("^javascript:+"); 7 const isDownloadDocument = new RegExp(".(doc|docx|pdf)$"); 8 9 jQuery('a').each(function(){ 10 const url = jQuery(this).attr("href"); 11 12 if (codeLinks.test(url)){ 13 return; 14 } 15 16 if (isDownloadDocument.test(url)) { 17 const docName = url.split('/').pop(); 18 19 jQuery(this).click(() => ga( 20 'send', 21 { 22 hitType: 'event', 23 eventCategory: 'Documents', 24 eventAction: 'download', 25 eventLabel: docName 26 } 27 )); 28 return; 29 } 30 31 }); 32 33});
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.