tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

webtrends.js (992B)


      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 1766414 - Shim WebTrends Core Tag and Advanced Link Tracking
      9 *
     10 * Sites using WebTrends Core Tag or Link Tracking can break if they are
     11 * are blocked. This shim mitigates that breakage by loading an empty module.
     12 */
     13 
     14 if (!window.dcsMultiTrack) {
     15  window.dcsMultiTrack = o => {
     16    o?.callback?.({});
     17  };
     18 }
     19 
     20 if (!window.WebTrends) {
     21  class dcs {
     22    addSelector() {
     23      return this;
     24    }
     25    addTransform() {
     26      return this;
     27    }
     28    DCSext = {};
     29    init(_obj) {
     30      return this;
     31    }
     32    track() {
     33      return this;
     34    }
     35  }
     36 
     37  window.Webtrends = window.WebTrends = {
     38    dcs,
     39    multiTrack: window.dcsMultiTrack,
     40  };
     41 
     42  window.requestAnimationFrame(() => {
     43    window.webtrendsAsyncLoad?.(dcs);
     44    window.webtrendsAsyncInit?.();
     45  });
     46 }