1(function () { 2 const ENDPOINT = 'https://analytics.fundacioncyd.org/collect.php'; 3 4 function getSession() { 5 let sid = sessionStorage.getItem('sid'); 6 if (!sid) { 7 sid = crypto.randomUUID(); 8 sessionStorage.setItem('sid', sid); 9 } 10 return sid; 11 } 12 13 function send(payload) { 14 payload.type = payload.type || 'pageview'; 15 payload.url = location.pathname; 16 payload.referrer = document.referrer || null; 17 payload.session_id = getSession(); 18 19 // ZONA HORARIA DEL CLIENTE 20 const now = new Date(); 21 payload.timestamp = now.toISOString().replace('T', ' ').replace(/\.\d{3}Z$/, ''); 22 // Dividir el path y filtrar partes vacÃas 23 const pathParts = location.pathname.split('/').filter(part => part.length > 0); 24 25 // Publication: última parte (siempre que haya al menos una) 26 payload.publication = pathParts.length > 0 ? pathParts[pathParts.length - 1] : ''; 27 28 // Category: penúltima parte (solo si hay 2 o más partes) 29 payload.category = pathParts.length > 1 ? pathParts[pathParts.length - 2] : ''; 30 31 navigator.sendBeacon( 32 ENDPOINT, 33 JSON.stringify(payload) 34 ); 35 } 36 37 // PAGEVIEW 38 send({ type: 'pageview' }); 39 40 // API pública 41 window.myAnalytics = { 42 event(name, value = null) { 43 send({ 44 type: 'event', 45 event_name: name, 46 event_value: value 47 }); 48 } 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.