1// Initialize global VWO campaigns array for tracking. 2window.vwoCampaigns = window.vwoCampaigns || []; 3 4/** 5 * Fetch VWO campaign data asynchronously. 6 * 7 * Waits for the 'onVWOCampaignsLoaded' event from the VWO API and resolves with 8 * the bucketed campaigns array. 9 * 10 * @returns {Promise<Array|undefined>} Resolves with the array of bucketed campaigns, or rejects on timeout. 11 */ 12window.getVWOCampaignData = async function getVWOCampaignData() { 13 window.VWO = window.VWO || []; 14 15 // If we already called the function, return the campaigns. 16 window.VWO.data = window.VWO.data || {}; 17 if (window.VWO.data.campaigns) { 18 return window.VWO.data.campaigns; 19 } 20 21 return await Promise.race([ 22 new Promise((resolve) => { 23 window.VWO.push([ 24 'onVWOCampaignsLoaded', 25 (data) => { 26 const {bucketed_campaigns} = data || {}; 27 28 // Store the result. 29 window.VWO.data.campaigns = bucketed_campaigns; 30 31 resolve(bucketed_campaigns); 32 } 33 ]); 34 }), 35 // Timeout after 2 seconds if the event doesn't fire. 36 new Promise((resolve) => setTimeout(() => resolve([]), 2000)) 37 ]); 38}; 39 40/** 41 * Injects the VWO tracking script. 42 * 43 * @returns {void} 44 */ 45function addVwoScript() { 46 window._vwo_code || 47 (function () { 48 var account_id = window.vwo.account_id || '', 49 version = 2.1, 50 settings_tolerance = 2000, 51 hide_element = 'body', 52 hide_element_style = 53 'opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;transition:none !important;', 54 /* DO NOT EDIT BELOW THIS LINE */ 55 f = false, 56 w = window, 57 d = document, 58 v = d.querySelector('#vwoCode'), 59 cK = '_vwo_' + account_id + '_settings', 60 cc = {}; 61 try { 62 var c = JSON.parse(localStorage.getItem('_vwo_' + account_id + '_config')); 63 cc = c && typeof c === 'object' ? c : {}; 64 } catch (e) {} 65 var stT = cc.stT === 'session' ? w.sessionStorage : w.localStorage; 66 code = { 67 nonce: v && v.nonce, 68 library_tolerance: function () { 69 return typeof library_tolerance !== 'undefined' ? library_tolerance : undefined; 70 }, 71 settings_tolerance: function () { 72 return cc.sT || settings_tolerance; 73 }, 74 hide_element_style: function () { 75 return '{' + (cc.hES || hide_element_style) + '}'; 76 }, 77 hide_element: function () { 78 if (performance.getEntriesByName('first-contentful-paint')[0]) { 79 return ''; 80 } 81 return typeof cc.hE === 'string' ? cc.hE : hide_element; 82 }, 83 getVersion: function () { 84 return version; 85 }, 86 finish: function (e) { 87 if (!f) { 88 f = true; 89 var t = d.getElementById('_vis_opt_path_hides'); 90 if (t) t.parentNode.removeChild(t); 91 if (e) new Image().src = 'https://dev.visualwebsiteoptimizer.com/ee.gif?a=' + account_id + e; 92 } 93 }, 94 finished: function () { 95 return f; 96 }, 97 addScript: function (e) { 98 var t = d.createElement('script'); 99 t.type = 'text/javascript'; 100 if (e.src) { 101 t.src = e.src; 102 } else { 103 t.text = e.text; 104 } 105 v && t.setAttribute('nonce', v.nonce); 106 d.getElementsByTagName('head')[0].appendChild(t); 107 }, 108 load: function (e, t) { 109 var n = this.getSettings(), 110 i = d.createElement('script'), 111 r = this; 112 t = t || {}; 113 if (n) { 114 i.textContent = n; 115 d.getElementsByTagName('head')[0].appendChild(i); 116 if (!w.VWO || VWO.caE) { 117 stT.removeItem(cK); 118 r.load(e); 119 } 120 } else { 121 var o = new XMLHttpRequest(); 122 o.open('GET', e, true); 123 o.withCredentials = !t.dSC; 124 o.responseType = t.responseType || 'text'; 125 o.onload = function () { 126 if (t.onloadCb) { 127 return t.onloadCb(o, e); 128 } 129 if (o.status === 200 || o.status === 304) { 130 _vwo_code.addScript({text: o.responseText}); 131 } else { 132 _vwo_code.finish('&e=loading_failure:' + e); 133 } 134 }; 135 o.onerror = function () { 136 if (t.onerrorCb) { 137 return t.onerrorCb(e); 138 } 139 _vwo_code.finish('&e=loading_failure:' + e); 140 }; 141 o.send(); 142 } 143 }, 144 getSettings: function () { 145 try { 146 var e = stT.getItem(cK); 147 if (!e) { 148 return; 149 } 150 e = JSON.parse(e); 151 if (Date.now() > e.e) { 152 stT.removeItem(cK); 153 return; 154 } 155 return e.s; 156 } catch (e) { 157 return; 158 } 159 }, 160 init: function () { 161 if (d.URL.indexOf('__vwo_disable__') > -1) return; 162 var e = this.settings_tolerance(); 163 w._vwo_settings_timer = setTimeout(function () { 164 _vwo_code.finish(); 165 stT.removeItem(cK); 166 }, e); 167 var t;
168 if (this.hide_element() !== 'body') { 169 t = d.createElement('style'); 170 var n = this.hide_element(), 171 i = n ? n + this.hide_element_style() : '', 172 r = d.getElementsByTagName('head')[0]; 173 t.setAttribute('id', '_vis_opt_path_hides'); 174 v && t.setAttribute('nonce', v.nonce); 175 t.setAttribute('type', 'text/css'); 176 if (t.styleSheet) t.styleSheet.cssText = i; 177 else t.appendChild(d.createTextNode(i)); 178 r.appendChild(t); 179 } else { 180 t = d.getElementsByTagName('head')[0]; 181 var i = d.createElement('div'); 182 i.style.cssText = 183 'z-index: 2147483647 !important;position: fixed !important;left: 0 !important;top: 0 !important;width: 100% !important;height: 100% !important;background: white !important;display: block !important;'; 184 i.setAttribute('id', '_vis_opt_path_hides'); 185 i.classList.add('_vis_hide_layer'); 186 t.parentNode.insertBefore(i, t.nextSibling); 187 } 188 var o = window._vis_opt_url || d.URL, 189 s = 190 'https://dev.visualwebsiteoptimizer.com/j.php?a=' + 191 account_id + 192 '&u=' + 193 encodeURIComponent(o) + 194 '&vn=' + 195 version; 196 if (w.location.search.indexOf('_vwo_xhr') !== -1) { 197 this.addScript({src: s}); 198 } else { 199 this.load(s + '&x=true'); 200 } 201 } 202 }; 203 w._vwo_code = code; 204 code.init(); 205 })(); 206} 207 208/** 209 * Checks for user consent via TCF or USP APIs and loads the VWO script if 210 * consent is present. 211 * 212 * Uses vendor ID 27 for VWO (TCF) and global consent for USP API. 213 * 214 * @returns {void} 215 */ 216function vwoConsentHandler() { 217 const nrvVendorId = 27; 218 219 if (window.__tcfapi) { 220 window.__tcfapi('getValidTCData', 2, () => { 221 window.__tcfapi('getNonRegisteredVendorsConsents', 2, (nrvList) => { 222 if (nrvList && nrvList?.[nrvVendorId]?.consent) { 223 addVwoScript(); 224 } 225 }); 226 }); 227 } else if (window.__uspapi) { 228 // US Yes/No check. 229 window.__uspapi('getUSPData', 1, () => { 230 window.__uspapi.a.push([ 231 'hasConsentedToAll', 232 null, 233 (hasConsent) => { 234 if (hasConsent) addVwoScript(); 235 } 236 ]); 237 }); 238 } 239} 240 241// If the adverts queue is available, push the VWO consent handler to it. 242// Otherwise, set a timeout to call the handler after a second. 243if (window?.adverts?.queue?.push) { 244 window.adverts.queue.push(vwoConsentHandler); 245} else { 246 // No ads on page, assume everything will have loaded by now. 247 setTimeout(vwoConsentHandler, 1000); 248} 249 250// Forward all gtagEvent() calls to VWO Data360. 251// window.iNews.eventHandlers is shared with the GA bundle; load order doesn't matter. 252window.iNews = window.iNews || {}; 253window.iNews.eventHandlers = window.iNews.eventHandlers || []; 254window.iNews.eventHandlers.push((eventName, props, customDimensions = {}) => { 255 window.VWO = window.VWO || []; 256 window.VWO.push(['event', eventName, {...customDimensions, ...props}]); 257});
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.