1(function() { 2 'use strict'; 3 4 // Automatisierte Browser (Puppeteer/Playwright/Selenium) kennzeichnen sich hier 5 if (navigator.webdriver) return; 6 7 var s = document.currentScript; 8 if (!s) return; 9 10 var siteId = s.getAttribute('data-site'); 11 if (!siteId) return; 12 13 var endpoint = s.src.replace(/\/lib\.js(\?.*)?$/, '/collect'); 14 15 function getUtmParams() { 16 var params = {}; 17 var search = window.location.search; 18 if (!search) return params; 19 var utmKeys = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content']; 20 for (var i = 0; i < utmKeys.length; i++) { 21 var match = search.match(new RegExp('[?&]' + utmKeys[i] + '=([^&]*)')); 22 if (match) params[utmKeys[i]] = decodeURIComponent(match[1]); 23 } 24 return params; 25 } 26 27 var h1 = document.querySelector('h1'); 28 29 var payload = { 30 s: siteId, 31 p: window.location.pathname, 32 t: document.title || '', 33 h: h1 ? h1.textContent.trim().substring(0, 200) : '', 34 r: document.referrer || '', 35 u: getUtmParams(), 36 l: (navigator.language || '').substring(0, 5) 37 }; 38 39 var url = endpoint; 40 var data = JSON.stringify(payload); 41 42 if (navigator.sendBeacon) { 43 navigator.sendBeacon(url, new Blob([data], { type: 'text/plain' })); 44 } else { 45 var xhr = new XMLHttpRequest(); 46 xhr.open('POST', url, true); 47 xhr.setRequestHeader('Content-Type', 'application/json'); 48 xhr.send(data); 49 } 50})();
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.