nielsen.js (2327B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 /** 8 * Bug 1760754 - Shim Nielsen tracker 9 * 10 * Sites expecting the Nielsen tracker to load properly can break if it 11 * is blocked. This shim mitigates that breakage by loading a stand-in. 12 */ 13 14 if (!window.nol_t) { 15 const cid = ""; 16 17 let domain = ""; 18 let schemeHost = ""; 19 let scriptName = ""; 20 try { 21 const url = document?.currentScript?.src; 22 const { pathname, protocol, host } = new URL(url); 23 domain = host.split(".").slice(0, -2).join("."); 24 schemeHost = `${protocol}//${host}/`; 25 scriptName = pathname.split("/").pop(); 26 } catch (_) {} 27 28 const NolTracker = class { 29 CONST = { 30 max_tags: 20, 31 }; 32 feat = {}; 33 globals = { 34 cid, 35 content: "0", 36 defaultApidFile: "config250", 37 defaultErrorParams: { 38 nol_vcid: "c00", 39 nol_clientid: "", 40 }, 41 domain, 42 fpidSfCodeList: [""], 43 init() {}, 44 tagCurrRetry: -1, 45 tagMaxRetry: 3, 46 wlCurrRetry: -1, 47 wlMaxRetry: 3, 48 }; 49 pmap = []; 50 pvar = { 51 cid, 52 content: "0", 53 cookies_enabled: "n", 54 server: domain, 55 }; 56 scriptName = [scriptName]; 57 version = "6.0.107"; 58 59 addScript() {} 60 catchLinkOverlay() {} 61 clickEvent() {} 62 clickTrack() {} 63 do_sample() {} 64 downloadEvent() {} 65 eventTrack() {} 66 filter() {} 67 fireToUrl() {} 68 getSchemeHost() { 69 return schemeHost; 70 } 71 getVersion() {} 72 iframe() {} 73 in_sample() { 74 return true; 75 } 76 injectBsdk() {} 77 invite() {} 78 linkTrack() {} 79 mergeFeatures() {} 80 pageEvent() {} 81 pause() {} 82 populateWhitelist() {} 83 post() {} 84 postClickTrack() {} 85 postData() {} 86 postEvent() {} 87 postEventTrack() {} 88 postLinkTrack() {} 89 prefix() { 90 return ""; 91 } 92 processDdrsSvc() {} 93 random() {} 94 record() { 95 return this; 96 } 97 regLinkOverlay() {} 98 regListen() {} 99 retrieveCiFileViaCors() {} 100 sectionEvent() {} 101 sendALink() {} 102 sendForm() {} 103 sendIt() {} 104 slideEvent() {} 105 whitelistAssigned() {} 106 }; 107 108 window.nol_t = () => { 109 return new NolTracker(); 110 }; 111 }