1(function () { 2 3 function setCookie(name, value, days) { 4 var expires = ""; 5 if (days) { 6 var date = new Date(); 7 date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); 8 expires = "; expires=" + date.toUTCString(); 9 } 10 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 11 } 12 function getCookie(name) { 13 var nameEQ = name + "="; 14 var ca = document.cookie.split(";"); 15 for (var i = 0; i < ca.length; i++) { 16 var c = ca[i]; 17 while (c.charAt(0) == " ") c = c.substring(1, c.length); 18 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); 19 } 20 return null; 21 } 22 23 function setUTMCookie(value) { 24 setCookie("kubio_utm_values", JSON.stringify(value)); 25 } 26 27 function getUTMCookie() { 28 var cookie = getCookie("kubio_utm_values"); 29 30 if (cookie) { 31 return JSON.parse(cookie); 32 } 33 34 return {}; 35 } 36 37 var utms = getUTMCookie(); 38 var kubioUpgradeKey = getCookie('kubio_upgrade_key'); 39 var kubioUserId = getCookie('kubio_user_id'); 40 41 var urlSearch = new URLSearchParams(window.location.search); 42 43 function updateCurrentUTMParams() { 44 urlSearch.forEach(function (item, key) { 45 if (key.indexOf("utm_") === 0 && key !== 'utm_upgrade_key') { 46 utms[key] = item; 47 } 48 }); 49 50 setUTMCookie(utms); 51 } 52 53 updateCurrentUTMParams(); 54 55 56 if (urlSearch.has('upgrade_key')) { 57 kubioUpgradeKey = urlSearch.get('upgrade_key'); 58 setCookie('kubio_upgrade_key', kubioUpgradeKey); 59 } else if (urlSearch.has('utm_upgrade_key')) { 60 kubioUpgradeKey = urlSearch.get('utm_upgrade_key'); 61 setCookie('kubio_upgrade_key', kubioUpgradeKey); 62 } 63 64 if (urlSearch.has('kubio_user_id')) { 65 kubioUserId = urlSearch.get('kubio_user_id'); 66 setCookie('kubio_user_id', kubioUserId); 67 } 68 69 window.KubioCookieManager = { 70 getUTMs() { 71 return utms; 72 }, 73 74 getUpgradeKey() { 75 return kubioUpgradeKey; 76 }, 77 78 getUserId() { 79 return kubioUserId; 80 }, 81 82 clearUpgradeKey() { 83 setCookie('kubio_upgrade_key', ''); 84 }, 85 86 clearUserId() { 87 setCookie('kubio_user_id', ''); 88 } 89 } 90})();
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.