1(function(){ 2 try { 3 if (!window.APELA_STATS_CFG || !APELA_STATS_CFG.hitEndpoint || !APELA_STATS_CFG.heartbeatEndpoint) return; 4 5 var ref = document.referrer || ''; 6 var stopped = false; 7 8 function cleanPath() { 9 try { 10 var u = new URL(location.href); 11 var drop = []; 12 u.searchParams.forEach(function(value, key){ 13 var k = String(key || '').toLowerCase(); 14 if ( 15 k === 'fbclid' || 16 k === 'gclid' || 17 k === 'dclid' || 18 k === 'msclkid' || 19 k === 'mc_cid' || 20 k === 'mc_eid' || 21 k.indexOf('utm_') === 0 22 ) { 23 drop.push(key); 24 } 25 }); 26 drop.forEach(function(key){ u.searchParams.delete(key); }); 27 var q = u.searchParams.toString(); 28 return u.pathname + (q ? '?' + q : ''); 29 } catch (e) { 30 return location.pathname + location.search; 31 } 32 } 33 34 function payload() { 35 return JSON.stringify({ 36 path: cleanPath(), 37 postId: Number(APELA_STATS_CFG.postId || 0), 38 ref: ref 39 }); 40 } 41 42 function send(url, body) { 43 if (navigator.sendBeacon) { 44 try { 45 var ok = navigator.sendBeacon(url, new Blob([body], {type:'application/json'})); 46 if (ok) return; 47 } catch (e) {} 48 } 49 50 fetch(url, { 51 method: 'POST', 52 credentials: 'same-origin', 53 headers: {'Content-Type':'application/json'}, 54 body: body, 55 keepalive: true 56 }).catch(function(){}); 57 } 58 59 // Îνα pageview ανά ÎºÎ±Î½Î¿Î½Î¹ÎºÏ ÏÏÏÏÏμα ÏελίδαÏ. 60 send(APELA_STATS_CFG.hitEndpoint, payload()); 61 62 // LIVE heartbeat. Îεν ÏÏοÏθÎÏει pageview. 63 function heartbeat() { 64 if (stopped || document.visibilityState === 'hidden') return; 65 send(APELA_STATS_CFG.heartbeatEndpoint, payload()); 66 } 67 68 heartbeat(); 69 70 var timer = setInterval(heartbeat, Number(APELA_STATS_CFG.heartbeatMs || 20000)); 71 72 document.addEventListener('visibilitychange', function(){ 73 if (document.visibilityState === 'visible') heartbeat(); 74 }); 75 76 window.addEventListener('pagehide', function(){ 77 stopped = true; 78 clearInterval(timer); 79 }, {once:true}); 80 } catch(e) {} 81})();
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.