PageSourceSearch

https://app.youscan.io/static/3rd-party/segment.js?t=1790939790907

js youscan.io collected 2026-10-02 14:30:15 UTC 3,794 bytes, 104 lines download raw bytes

1/* eslint-disable */
2// Segment Analytics.js 2.0 snippet (SNIPPET_VERSION 5.2.0).
3// Upgraded from the classic 1.0 snippet so Segment can auto-load the Amplitude
4// (Actions) Session Plugin — it runs session tracking from Segment's CDN and
5// replaces the legacy device-mode Amplitude SDK (which bundled a vulnerable
6// ua-parser-js). Session tracking requires Analytics.js 2.0.
7!(function () {
8    function isExportMode() {
9        return new URLSearchParams(location.search).get('exportMode') === '1';
10    }
11
12    if (isExportMode()) {
13        return;
14    }
15
16    var i = 'analytics';
17    var analytics = (window[i] = window[i] || []);
18    if (analytics.initialize) return;
19    if (analytics.invoked) {
20        window.console && console.error && console.error('Segment snippet included twice.');
21        return;
22    }
23    analytics.invoked = true;
24    analytics.methods = [
25        'trackSubmit',
26        'trackClick',
27        'trackLink',
28        'trackForm',
29        'pageview',
30        'identify',
31        'reset',
32        'group',
33        'track',
34        'ready',
35        'alias',
36        'debug',
37        'page',
38        'screen',
39        'once',
40        'off',
41        'on',
42        'addSourceMiddleware',
43        'addIntegrationMiddleware',
44        'setAnonymousId',
45        'addDestinationMiddleware',
46        'register',
47    ];
48    analytics.factory = function (e) {
49        return function () {
50            if (window[i].initialized) {
51                return window[i][e].apply(window[i], arguments);
52            }
53            var args = Array.prototype.slice.call(arguments);
54            if (['track', 'screen', 'alias', 'group', 'page', 'identify'].indexOf(e) > -1) {
55                var c = document.querySelector("link[rel='canonical']");
56                args.push({
57                    __t: 'bpc',
58                    c: (c && c.getAttribute('href')) || undefined,
59                    p: location.pathname,
60                    u: location.href,
61                    s: location.search,
62                    t: document.title,
63                    r: document.referrer,
64                });
65            }
66            args.unshift(e);
67            analytics.push(args);
68            return analytics;
69        };
70    };
71    for (var n = 0; n < analytics.methods.length; n++) {
72        var key = analytics.methods[n];
73        analytics[key] = analytics.factory(key);
74    }
75    analytics.load = function (key, options) {
76        var t = document.createElement('script');
77        t.type = 'text/javascript';
78        t.async = true;
79        t.setAttribute('data-global-segment-analytics-key', i);
80        t.src = 'https://cdn.segment.com/analytics.js/v1/' + key + '/analytics.min.js';
81        var first = document.getElementsByTagName('script')[0];
82        first.parentNode.insertBefore(t, first);
83        analytics._loadOptions = options;
84    };
85    analytics.SNIPPET_VERSION = '5.2.0';
86
87    var segmentId = window.__CONFIG__ && window.__CONFIG__.segmentId;
88    if (!segmentId || segmentId === 'xxxx' || segmentId === 'XXX') {
89        return;
90    }
91    // The same image is promoted to every environment, so config.js cannot tell a preview
92    // apart from production — the pages.dev and workers.dev previews ship the production
93    // segmentId, and `bin/generate-config.js` gives localhost the same one. Hostname is the
94    // only reliable discriminator at runtime.
95    var host = window.location.hostname;
96    // slice, not lastIndexOf: lastIndexOf returns -1 when absent, and `host.length - 11` is
97    // also -1 for any 10-character host — so `google.com` compared equal and fell through.
98    if (host !== 'youscan.io' && host.slice(-11) !== '.youscan.io') {
99        return;
100    }
101    analytics._writeKey = segmentId;
102    analytics.load(segmentId);
103    analytics.page();
104})();

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.