PageSourceSearch

http://epicapks.com/js/onetrusttracking.js

js epicapks.com collected 2026-09-28 08:23:26 UTC 4,099 bytes, 113 lines download raw bytes

1const FR_OTT = (function () {
2
3    const _once = new window.WeakMap();
4    function once(fn) {
5        return function () {
6            if (!_once.get(fn)) {
7                _once.set(fn, fn);
8                window.setTimeout(function () {
9                    fn();
10                }, 1000);
11            }
12        };
13    }
14
15    const trackOneTrustBanner = once(function () {
16
17        function _get(obj, key, def, p) {
18            p = 0;
19            key = key.split ? key.split('.') : key;
20            while (obj && p < key.length) obj = obj[key[p++]];
21            return (obj === undefined || p < key.length) ? def : obj;
22        }
23
24        // Attempted to safely get the Analytic Platform tracking function
25        function getTrackingFunction() {
26            const trackingFunction = _get(window, 'analyticsVendors.AdobeAnalytics.componentFunction_Custom');
27            const pageLoadDeferred = _get(window, 'digitalData.loadState.pageLoad');
28
29            return (trackingFunction && pageLoadDeferred) ?
30                function () {
31                    const args = arguments;
32                    // Wait for event21 to fire first...
33                    pageLoadDeferred.then(function () {
34                        // ... Then fire the tracking function
35                        // with the passed in arguments
36                        trackingFunction.apply(window, args);
37                    });
38                // eslint-disable-next-line no-empty-function
39                } : function() {};
40        }
41
42        // Run some code after the Analytics Platform is ready
43        function whenAnalyticsPlatformReady(callback) {
44            if (window.VRI_AnalyticsLoaded) {
45                callback();
46            } else {
47                window.addEventListener('VRI_AnalyticsLoaded', function () {
48                    callback();
49                });
50            }
51        }
52
53        function setPev2(scenario) {
54            switch (scenario) {
55                case 'banner_shown':
56                    return 'Cookie Consent | CCPA | Banner Shown';
57
58                case 'accept_all_cookies':
59                    return 'Cookie Consent | CCPA | Accept Cookies';
60
61                case 'privacy_policy':
62                    return 'Cookie Consent | CCPA | Privacy Policy';
63                case 'close_banner':
64                    return 'Cookie Consent | CCPA | Close Banner';
65            }
66        }
67
68        function trackScenario(scenario, data) {
69            whenAnalyticsPlatformReady(function () {
70                const analyticsFunction = getTrackingFunction();
71
72                analyticsFunction({
73                    componentTracking: {
74                        component: {
75                            componentInfo: {
76                                componentID: '3rdParty_OneTrust',
77                                componentName: 'Banner'
78                            }
79                        }
80                    },
81                    pev2: setPev2(scenario)
82                });
83            });
84        }
85
86        const $oneTrustBanner = $(document.querySelector('#onetrust-banner-sdk'));
87        const acceptCookiesButtonSelector = '#onetrust-accept-btn-handler';
88        const closeButtonSelector = '.onetrust-close-btn-handler';
89        const privacyPolicyAnchorSelector = '#vr-onetrust-privacy-policy-link-handler';
90
91        if ($oneTrustBanner.is(':visible')) {
92            trackScenario('banner_shown');
93        }
94
95        $oneTrustBanner.on('click', acceptCookiesButtonSelector, function () {
96            trackScenario('accept_all_cookies');
97        });
98        $oneTrustBanner.on('click', closeButtonSelector, function () {
99            trackScenario('close_banner');
100        });
101        $oneTrustBanner.on('click', privacyPolicyAnchorSelector, function () {
102            trackScenario('privacy_policy');
103        });
104    });
105
106    return trackOneTrustBanner;
107
108}());
109
110// eslint-disable-next-line no-unused-vars
111function OptanonWrapper(scenario, data) {
112    FR_OTT();
113}

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.