summaryrefslogtreecommitdiffstats
path: root/browser/extensions/webcompat/shims/nielsen.js
blob: 5584a126cb246c97f33bc49cd14a13723d704dac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

"use strict";

/**
 * Bug 1760754 - Shim Nielsen tracker
 *
 * Sites expecting the Nielsen tracker to load properly can break if it
 * is blocked. This shim mitigates that breakage by loading a stand-in.
 */

if (!window.nol_t) {
  const cid = "";

  let domain = "";
  let schemeHost = "";
  let scriptName = "";
  try {
    const url = document?.currentScript?.src;
    const { pathname, protocol, host } = new URL(url);
    domain = host
      .split(".")
      .slice(0, -2)
      .join(".");
    schemeHost = `${protocol}//${host}/`;
    scriptName = pathname.split("/").pop();
  } catch (_) {}

  const NolTracker = class {
    CONST = {
      max_tags: 20,
    };
    feat = {};
    globals = {
      cid,
      content: "0",
      defaultApidFile: "config250",
      defaultErrorParams: {
        nol_vcid: "c00",
        nol_clientid: "",
      },
      domain,
      fpidSfCodeList: [""],
      init() {},
      tagCurrRetry: -1,
      tagMaxRetry: 3,
      wlCurrRetry: -1,
      wlMaxRetry: 3,
    };
    pmap = [];
    pvar = {
      cid,
      content: "0",
      cookies_enabled: "n",
      server: domain,
    };
    scriptName = [scriptName];
    version = "6.0.107";

    addScript() {}
    catchLinkOverlay() {}
    clickEvent() {}
    clickTrack() {}
    do_sample() {}
    downloadEvent() {}
    eventTrack() {}
    filter() {}
    fireToUrl() {}
    getSchemeHost() {
      return schemeHost;
    }
    getVersion() {}
    iframe() {}
    in_sample() {
      return true;
    }
    injectBsdk() {}
    invite() {}
    linkTrack() {}
    mergeFeatures() {}
    pageEvent() {}
    pause() {}
    populateWhitelist() {}
    post() {}
    postClickTrack() {}
    postData() {}
    postEvent() {}
    postEventTrack() {}
    postLinkTrack() {}
    prefix() {
      return "";
    }
    processDdrsSvc() {}
    random() {}
    record() {
      return this;
    }
    regLinkOverlay() {}
    regListen() {}
    retrieveCiFileViaCors() {}
    sectionEvent() {}
    sendALink() {}
    sendForm() {}
    sendIt() {}
    slideEvent() {}
    whitelistAssigned() {}
  };

  window.nol_t = () => {
    return new NolTracker();
  };
}