1(function () { 2 "use strict"; 3 4 var config = window.rogueAnalyticsConfig; 5 if (!config || !config.endpoint) return; 6 if (navigator.globalPrivacyControl === true || navigator.doNotTrack === "1") return; 7 8 var pageId = "rn_" + randomId(); 9 var startedAt = Date.now(); 10 var sentEngagement = false; 11 12 function randomId() { 13 if (window.crypto && window.crypto.getRandomValues) { 14 var bytes = new Uint8Array(16); 15 window.crypto.getRandomValues(bytes); 16 return Array.prototype.map.call(bytes, function (n) { 17 return n.toString(16).padStart(2, "0"); 18 }).join(""); 19 } 20 return String(Date.now()) + Math.random().toString(36).slice(2); 21 } 22 23 function campaign() { 24 var params = new URLSearchParams(window.location.search); 25 return { 26 source: params.get("utm_source") || "", 27 medium: params.get("utm_medium") || "", 28 campaign: params.get("utm_campaign") || "", 29 }; 30 } 31 32 function send(payload) { 33 var body = JSON.stringify(payload); 34 if (navigator.sendBeacon) { 35 navigator.sendBeacon(config.endpoint, new Blob([body], { type: "application/json" })); 36 return; 37 } 38 fetch(config.endpoint, { 39 method: "POST", 40 body: body, 41 headers: { "Content-Type": "application/json" }, 42 credentials: "omit", 43 keepalive: true, 44 }).catch(function () {}); 45 } 46 47 var attribution = campaign(); 48 send({ 49 type: "pageview", 50 pageId: pageId, 51 path: window.location.pathname, 52 referrer: document.referrer, 53 source: attribution.source, 54 medium: attribution.medium, 55 campaign: attribution.campaign, 56 }); 57 58 function engagement() { 59 if (sentEngagement) return; 60 sentEngagement = true; 61 send({ 62 type: "engagement", 63 pageId: pageId, 64 engagementMs: Math.max(0, Date.now() - startedAt), 65 }); 66 } 67 68 window.addEventListener("pagehide", engagement, { once: true }); 69 document.addEventListener("visibilitychange", function () { 70 if (document.visibilityState === "hidden") engagement(); 71 }); 72 73 window.rogueAnalytics = { 74 track: function (name) { 75 send({ 76 type: "conversion", 77 pageId: "cv_" + randomId(), 78 path: window.location.pathname, 79 campaign: String(name || "conversion").slice(0, 120), 80 }); 81 }, 82 }; 83})();
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.