PageSourceSearch

https://clickstream.com/assets/cookie-consent.js?v=20261001-2

js clickstream.com collected 2026-10-05 05:16:41 UTC 6,063 bytes, 134 lines download raw bytes

1(function() {
2  var COOKIE_NAME = 'cs_cookie_consent';
3  var COOKIE_DAYS = 365;
4
5  function isStorageUnavailable() {
6    var cookieReadable = true;
7    var localStorageReadable = true;
8
9    try { void document.cookie; } catch(e) { cookieReadable = false; }
10    try { void localStorage.getItem(COOKIE_NAME); } catch(e) { localStorageReadable = false; }
11
12    return !cookieReadable && !localStorageReadable;
13  }
14
15  function getCookie(name) {
16    try {
17      var escapedName = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
18      var match = document.cookie.match(new RegExp('(?:^|;\\s*)' + escapedName + '=([^;]*)'));
19      return match ? decodeURIComponent(match[1]) : null;
20    } catch(e) {
21      return null;
22    }
23  }
24
25  function setCookie(name, value, days) {
26    try {
27      var expires = new Date(Date.now() + days * 864e5).toUTCString();
28      document.cookie = name + '=' + encodeURIComponent(value)
29        + '; expires=' + expires
30        + '; path=/; SameSite=Lax; Secure';
31    } catch(e) {}
32  }
33
34  function getStoredConsent() {
35    try { return localStorage.getItem(COOKIE_NAME); } catch(e) { return null; }
36  }
37
38  function getConsent() {
39    return getCookie(COOKIE_NAME) || getStoredConsent();
40  }
41
42  function setConsent(choice, useCookie) {
43    if (useCookie) {
44      setCookie(COOKIE_NAME, choice, COOKIE_DAYS);
45    }
46    try { localStorage.setItem(COOKIE_NAME, choice); } catch(e) {}
47  }
48
49  // Records an Accept with the ClickStream SDK so identity partners may load.
50  // Waits for the SDK to finish starting: a consent receipt sent before the
51  // visitor id exists is rejected by the collector.
52  function grantPartnerConsent() {
53    var tries = 0;
54    (function attempt() {
55      var tracker = window.cs;
56      if (tracker && typeof tracker.setConsent === 'function' && tracker.initialized === true
57          && typeof tracker.visitorId === 'string' && tracker.visitorId) {
58        try {
59          var state = typeof tracker.getConsent === 'function' ? tracker.getConsent() : null;
60          // The SDK's strict partner check counts only a grant it recorded as
61          // explicit. A visitor who accepted before it recorded that would
62          // otherwise never load partner scripts again, so re-assert it.
63          var explicitGrant = !!state && Array.isArray(state.explicit) && state.explicit.indexOf('thirdParty') !== -1;
64          if (!state || state.method === 'default_accept' || state.thirdParty !== true || !explicitGrant) {
65            var pending = tracker.setConsent({ thirdParty: true });
66            if (pending && typeof pending.catch === 'function') pending.catch(function() {});
67          }
68        } catch(e) {}
69        return;
70      }
71      if (++tries < 80) setTimeout(attempt, 250);
72    })();
73  }
74
75  if (isStorageUnavailable()) return;
76  var existing = getConsent();
77  if (existing) {
78    if (existing === 'accepted') grantPartnerConsent();
79    return;
80  }
81
82  var css = document.createElement('style');
83  css.textContent = [
84    '.cs-consent{position:fixed;bottom:0;left:0;right:0;z-index:10000;padding:16px;pointer-events:none;font-family:Inter,system-ui,sans-serif}',
85    '.cs-consent-inner{max-width:720px;margin:0 auto;background:rgba(255,255,255,0.92);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border:1px solid rgba(255,255,255,0.6);border-radius:16px;box-shadow:0 -4px 32px rgba(0,0,0,0.08);padding:24px 28px;display:flex;align-items:center;gap:20px;pointer-events:auto}',
86    '.cs-consent-text{flex:1;font-size:13px;line-height:1.6;color:#4a4a5a}',
87    '.cs-consent-text a{color:#0E9AA7;text-decoration:none;font-weight:500}',
88    '.cs-consent-text a:hover{text-decoration:underline}',
89    '.cs-consent-actions{display:flex;gap:10px;flex-shrink:0}',
90    '.cs-consent-btn{border:none;cursor:pointer;font-family:Inter,system-ui,sans-serif;font-size:13px;font-weight:600;padding:10px 20px;border-radius:50px;transition:all 150ms ease}',
91    '.cs-consent-accept{background:#0E9AA7;color:#fff}',
92    '.cs-consent-accept:hover{background:#0b8a96;transform:translateY(-1px);box-shadow:0 4px 12px rgba(14,154,167,0.3)}',
93    '.cs-consent-decline{background:transparent;color:#4a4a5a;border:1px solid #d1d5db}',
94    '.cs-consent-decline:hover{background:#f3f4f6}',
95    '@media(max-width:600px){.cs-consent-inner{flex-direction:column;gap:14px;padding:20px}.cs-consent-actions{width:100%;justify-content:stretch}.cs-consent-btn{flex:1;padding:12px 16px}}'
96  ].join('');
97  document.head.appendChild(css);
98
99  var banner = document.createElement('div');
100  banner.className = 'cs-consent';
101  banner.innerHTML =
102    '<div class="cs-consent-inner">' +
103      '<div class="cs-consent-text">' +
104        'We use first-party cookies to recognize returning visitors. Accept to also allow our identity partners\u2019 cookies. ' +
105        '<a href="/#privacy" class="cs-consent-privacy">Privacy Policy</a>' +
106      '</div>' +
107      '<div class="cs-consent-actions">' +
108        '<button class="cs-consent-btn cs-consent-decline">Decline</button>' +
109        '<button class="cs-consent-btn cs-consent-accept">Accept</button>' +
110      '</div>' +
111    '</div>';
112  document.body.appendChild(banner);
113
114  function dismiss(choice) {
115    // Accepted → persist with cookie + localStorage
116    // Declined → localStorage only (no new cookies)
117    setConsent(choice, choice === 'accepted');
118    if (choice === 'accepted') grantPartnerConsent();
119    banner.style.transition = 'opacity 300ms ease, transform 300ms ease';
120    banner.style.opacity = '0';
121    banner.style.transform = 'translateY(20px)';
122    setTimeout(function() { banner.remove(); }, 300);
123  }
124
125  banner.querySelector('.cs-consent-accept').addEventListener('click', function() { dismiss('accepted'); });
126  banner.querySelector('.cs-consent-decline').addEventListener('click', function() { dismiss('declined'); });
127
128  banner.querySelector('.cs-consent-privacy').addEventListener('click', function(e) {
129    if (typeof openModal === 'function' && document.getElementById('privacyModal')) {
130      e.preventDefault();
131      openModal('privacyModal');
132    }
133  });
134})();

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.