1(function () { 2 var ENDPOINT = 'https://go.cenarioconsulta.com.br/api/sessao'; 3 var COOKIE_NAME = 'cc_sid'; 4 var COOKIE_MAX_AGE = 60 * 60 * 24 * 365; 5 6 function uuidv4() { 7 if (window.crypto && typeof window.crypto.randomUUID === 'function') { 8 return window.crypto.randomUUID(); 9 } 10 var bytes = new Uint8Array(16); 11 if (window.crypto && window.crypto.getRandomValues) { 12 window.crypto.getRandomValues(bytes); 13 } else { 14 for (var i = 0; i < 16; i++) bytes[i] = Math.floor(Math.random() * 256); 15 } 16 bytes[6] = (bytes[6] & 0x0f) | 0x40; 17 bytes[8] = (bytes[8] & 0x3f) | 0x80; 18 var hex = []; 19 for (var j = 0; j < 16; j++) { 20 hex.push(('0' + bytes[j].toString(16)).slice(-2)); 21 } 22 return ( 23 hex.slice(0, 4).join('') + '-' + 24 hex.slice(4, 6).join('') + '-' + 25 hex.slice(6, 8).join('') + '-' + 26 hex.slice(8, 10).join('') + '-' + 27 hex.slice(10, 16).join('') 28 ); 29 } 30 31 function getCookie(name) { 32 var match = document.cookie.match(new RegExp('(?:^|; )' + name.replace(/([.$?*|{}()[\]\\/+^])/g, '\\$1') + '=([^;]*)')); 33 return match ? decodeURIComponent(match[1]) : ''; 34 } 35 36 function setCookie(name, value, maxAge) { 37 var secure = location.protocol === 'https:' ? '; Secure' : ''; 38 document.cookie = 39 name + '=' + encodeURIComponent(value) + 40 '; Path=/' + 41 '; Max-Age=' + maxAge + 42 '; SameSite=Lax' + 43 secure; 44 } 45 46 function isMacroPlaceholder(value) { 47 if (!value) return true; 48 return /^\{[^}]+\}$/.test(String(value).trim()); 49 } 50 51 function getParam(key) { 52 try { 53 var value = new URLSearchParams(window.location.search).get(key) || ''; 54 if (value && !isMacroPlaceholder(value)) return value; 55 } catch (e) {} 56 var stored = getCookie('cc_utm_' + key); 57 return stored && !isMacroPlaceholder(stored) ? stored : ''; 58 } 59 60 function detectDevice() { 61 var ua = navigator.userAgent || ''; 62 if (/Mobi|Android|iPhone|iPad|iPod/i.test(ua)) { 63 if (/iPad|Tablet/i.test(ua)) return 'tablet'; 64 return 'mobile'; 65 } 66 return 'desktop'; 67 } 68 69 function ensureSessionId() { 70 var sid = getCookie(COOKIE_NAME); 71 if (sid && /^[a-f0-9-]{36}$/i.test(sid)) { 72 return sid; 73 } 74 sid = uuidv4();
75 setCookie(COOKIE_NAME, sid, COOKIE_MAX_AGE); 76 return sid; 77 } 78 79 function buildPayload(sessionId) { 80 var params = { 81 session_id: sessionId, 82 site: location.hostname, 83 page_path: location.pathname + location.search, 84 device_type: detectDevice(), 85 event: 'pageview', 86 aff_sub: getParam('aff_sub'), 87 utm_source: getParam('utm_source'), 88 utm_medium: getParam('utm_medium'), 89 utm_campaign: getParam('utm_campaign'), 90 utm_term: getParam('utm_term'), 91 utm_content: getParam('utm_content') 92 }; 93 var qs = []; 94 Object.keys(params).forEach(function (k) { 95 if (params[k] !== '' && params[k] != null) { 96 qs.push(encodeURIComponent(k) + '=' + encodeURIComponent(params[k])); 97 } 98 }); 99 return qs.join('&'); 100 } 101 102 function send(sessionId) { 103 var qs = buildPayload(sessionId); 104 var url = ENDPOINT + '?' + qs; 105 106 try { 107 if (navigator.sendBeacon) { 108 var ok = navigator.sendBeacon(url); 109 if (ok) return; 110 } 111 } catch (e) {} 112 113 try { 114 var img = new Image(); 115 img.decoding = 'async'; 116 img.src = url; 117 } catch (e2) {} 118 } 119 120 try { 121 var sid = ensureSessionId(); 122 send(sid); 123 } catch (e) {} 124})();
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.