PageSourceSearch

https://www.fool.com/scripts/infotrack-init.js

js fool.com collected 2026-10-01 06:34:58 UTC 2,812 bytes, 121 lines download raw bytes

1/**
2 * InfoTrack Initialization Script
3 *
4 * This script initializes the InfoTrack analytics system. It's loaded from a separate file
5 * instead of using dangerouslySetInnerHTML for better security and maintainability.
6 */
7
8// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Called externally by OneTrust cookie consent
9function OptanonWrapper() {
10  var t;
11  if (window.infotrackInitialized || void 0 === window.Infotrack) {
12    window.Infotrack.setSegmentIntegrations();
13  } else {
14    window.infotrackInitialized = !0;
15    Infotrack.load(
16      "https://g.foolcdn.com/mms/resources/js/infotrack-ot_min.js"
17    );
18    t = t || 0;
19    setTimeout(function () {
20      window.Infotrack.initialize(window.infotrackProjectName);
21    }, t);
22  }
23}
24
25if (window.top != window) {
26  window.analytics = window.top.analytics;
27  window.inIframe = !0;
28}
29
30/* eslint-disable @typescript-eslint/no-unused-vars -- Used by external analytics system */
31var segmentKey = window.infotrackSegmentKey,
32  segmentSnippetVersion = "4.15.2";
33
34function getSegmentUrl(t) {
35  t = t || window.segmentKey;
36  return (
37    ("https:" === document.location.protocol ? "https://" : "http://") +
38    "evs.pink-boat.fool.com/analytics.js/v1/" +
39    t +
40    "/analytics.min.js"
41  );
42}
43/* eslint-enable @typescript-eslint/no-unused-vars */
44
45function trackerMaker(t) {
46  function n(n) {
47    function t() {
48      var t = Array.prototype.slice.call(arguments, 0),
49        t = [n].concat(t);
50      e.push(t);
51    }
52    return (t.stub = !0), t;
53  }
54
55  var e = [];
56  e.invoked = !1;
57  e.methods = [
58    "trackSubmit",
59    "trackClick",
60    "trackLink",
61    "trackForm",
62    "pageview",
63    "identify",
64    "reset",
65    "group",
66    "track",
67    "ready",
68    "alias",
69    "debug",
70    "page",
71    "once",
72    "off",
73    "on"
74  ];
75
76  if (t) {
77    e.methods = e.methods.concat(t);
78  }
79
80  for (var o = 0; o < e.methods.length; o++) {
81    var i = e.methods[o];
82    e[i] = n(i);
83  }
84
85  e.load = function (t) {
86    var n;
87    if (e.invoked) {
88      if (window["console"] && window["console"].error) {
89        window["console"].error(
90          JSON.stringify({
91            level: "error",
92            message: "infotrackInit.trackingSnippetIncludedTwice"
93          })
94        );
95      }
96    } else {
97      n = document.createElement("script");
98      n.type = "text/javascript";
99      n.async = !0;
100      n.src = t;
101      t = document.getElementsByTagName("script")[0];
102      t.parentNode.insertBefore(n, t);
103      e.invoked = !0;
104    }
105  };
106
107  return e;
108}
109
110// Initialize trackers
111window.analytics =
112  window.analytics ||
113  trackerMaker([
114    "addSourceMiddleware",
115    "addIntegrationMiddleware",
116    "setAnonymousId",
117    "addDestinationMiddleware"
118  ]);
119
120window.Infotrack =
121  window.Infotrack || trackerMaker(["initialize", "setSegmentIntegrations"]);

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.