PageSourceSearch

https://www.zoosk.com/assets/js/analytics.js

js zoosk.com collected 2026-09-24 08:59:20 UTC 3,520 bytes, 85 lines download raw bytes

1// Marketing/reporting analytics for the www landing. GTM loads early with Consent
2// Mode v2 defaults (same as zoosk-bonfire). Amplitude/PostHog load when analytics
3// consent is granted via vanilla-cookieconsent.
4import { initCookieConsent } from "./cookie-consent.js";
5import { CookieCategory, getCcCookieConsent, initGtmWithConsents } from "./consent-helpers.js";
6
7const cfg = window.__LANDING || {};
8
9let analyticsStarted = false;
10
11const initAmplitude = (key) => {
12  if (!key) return;
13  const s = document.createElement("script");
14  s.async = true;
15  s.src = "https://cdn.amplitude.com/script/" + key + ".js";
16  s.onload = () => {
17    if (window.amplitude) window.amplitude.init(key, { autocapture: { sessionReplay: false } });
18  };
19  document.head.appendChild(s);
20};
21
22const initPostHog = (key, host) => {
23  if (!key) return;
24  /* eslint-disable */
25  !(function (t, e) {
26    var o, n, p, r;
27    e.__SV ||
28      ((window.posthog = e),
29      (e._i = []),
30      (e.init = function (i, s, a) {
31        function g(t, e) {
32          var o = e.split(".");
33          2 == o.length && ((t = t[o[0]]), (e = o[1])), (t[e] = function () {
34            t.push([e].concat(Array.prototype.slice.call(arguments, 0)));
35          });
36        }
37        ((p = t.createElement("script")).type = "text/javascript"),
38          (p.async = !0),
39          (p.src = s.api_host + "/static/array.js"),
40          (r = t.getElementsByTagName("script")[0]).parentNode.insertBefore(p, r);
41        var u = e;
42        for (
43          void 0 !== a ? (u = e[a] = []) : (a = "posthog"),
44            u.people = u.people || [],
45            u.toString = function (t) {
46              var e = "posthog";
47              return "posthog" !== a && (e += "." + a), t || (e += " (stub)"), e;
48            },
49            u.people.toString = function () {
50              return u.toString(1) + ".people (stub)";
51            },
52            o =
53              "init capture register register_once register_for_session unregister unregister_for_session getFeatureFlag getFeatureFlagPayload isFeatureEnabled reloadFeatureFlags updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures on onFeatureFlags onSessionId getSurveys getActiveMatchingSurveys renderSurvey canRenderSurvey identify setPersonProperties group resetGroups setPersonPropertiesForFlags resetPersonPropertiesForFlags setGroupPropertiesForFlags resetGroupPropertiesForFlags reset get_distinct_id getGroups get_session_id get_session_replay_url alias set_config startSessionRecording stopSessionRecording sessionRecordingStarted captureException loadToolbar get_property getSessionProperty createPersonProfile opt_in_capturing opt_out_capturing has_opted_in_capturing has_opted_out_capturing clear_opt_in_out_capturing debug getPageViewId captureTraceFeedback captureTraceMetric".split(
54                " "
55              ),
56            n = 0;
57          n < o.length;
58          n++
59        )
60          g(u, o[n]);
61        e._i.push([i, s, a]);
62      }),
63      (e.__SV = 1));
64  })(document, window.posthog || []);
65  /* eslint-enable */
66  window.posthog.init(key, { api_host: host, person_profiles: "identified_only" });
67};
68
69const startAnalytics = () => {
70  if (analyticsStarted) return;
71  analyticsStarted = true;
72  initAmplitude(cfg.amplitudeKey);
73  initPostHog(cfg.posthogKey, cfg.posthogHost);
74};
75
76initGtmWithConsents(cfg.gtmId);
77
78initCookieConsent({
79  onAnalyticsConsent: startAnalytics,
80});
81
82const existing = getCcCookieConsent();
83if (existing?.includes(CookieCategory.ANALYTICS)) {
84  startAnalytics();
85}

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.