1import {CookieUtils} from 'sites/cookie_utils' 2import {FetchUtils} from 'common/fetch_utils' 3 4export class BeaconUtils { 5 6 static transmitData(url, data) { 7 if (js_vars.ct.active) { 8 fetch(url, { 9 method: 'POST', 10 headers: FetchUtils.jsonCsrfHeaders(), 11 keepalive: true, 12 body: JSON.stringify(data) 13 }).catch((exception) => { 14 console.debug(`Beacon fetch failed: ${exception}`) 15 navigator.sendBeacon(url, new Blob([data], {type: 'application/json;charset=UTF-8'})) 16 }) 17 } 18 } 19 20 static commonData() { 21 return { 22 url: window.location.href, 23 referrer: document.referrer, 24 user_agent: window.navigator.userAgent, 25 web_identity: CookieUtils.trackingCookie(), 26 web_session: CookieUtils.trackingSessionCookie() 27 } 28 } 29}
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.