1(() => { 2 'use strict'; 3 4 const endpoint = '/tracking/origem.php'; 5 const chaveControle = 'portalidea_origem_registrada_ate'; 6 const validadeControle = 29 * 24 * 60 * 60 * 1000; 7 8 const params = new URLSearchParams(window.location.search); 9 const origem = (params.get('utm_source') || '').trim().slice(0, 200); 10 const meio = (params.get('utm_medium') || '').trim().slice(0, 200); 11 const campanha = (params.get('utm_campaign') || '').trim().slice(0, 200); 12 const temUtm = origem !== '' || meio !== '' || campanha !== ''; 13 14 let controleValido = false; 15 16 try { 17 const ate = Number(localStorage.getItem(chaveControle) || '0'); 18 controleValido = Number.isFinite(ate) && ate > Date.now(); 19 } catch (_) { 20 controleValido = false; 21 } 22 23 if (!temUtm && controleValido) { 24 return; 25 } 26 27 const dados = new URLSearchParams(); 28 if (origem !== '') dados.set('utm_source', origem); 29 if (meio !== '') dados.set('utm_medium', meio); 30 if (campanha !== '') dados.set('utm_campaign', campanha); 31 32 fetch(endpoint, { 33 method: 'POST', 34 credentials: 'same-origin', 35 cache: 'no-store', 36 keepalive: true, 37 headers: { 38 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' 39 }, 40 body: dados.toString() 41 }) 42 .then((resposta) => { 43 if (!resposta.ok) return; 44 45 try { 46 localStorage.setItem( 47 chaveControle, 48 String(Date.now() + validadeControle) 49 ); 50 } catch (_) { 51 // O cookie já foi tratado pelo endpoint; o marcador é só otimização. 52 } 53 }) 54 .catch(() => { 55 // Rastreamento nunca deve bloquear a navegação. 56 }); 57})();
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.