var pixel_kwargs = pixel_kwargs || {}; pixel_kwargs.client_id = '0e9cb308-483c-4f6b-a867-53a9a2b2744f'; pixel_kwargs.site_id = '1267b882-9e29-484b-a5d3-750438561eaa'; // pixel_kwargs.subdomain = 'omni-iq'; (function() { if (!discover_site_id) { console.error("Site ID is not correct"); return; } loadScript(); setTimeout(()=> { sendApiRequest('page'); }, 1000); function sendApiRequest(event) { const apiUrl = 'https://api.throttleup.ai/event'; const payload = { action: event, timestamp: new Date().toISOString(), name: getPageFromUrl(window.location.href), title: document.title, site_id: discover_site_id, }; if (pixel_kwargs.md5) { payload['hash'] = pixel_kwargs.md5; } fetch(apiUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }).then(async response => { const resp = await response.json(); // if (resp.process) { // loadScript(); // } }).catch(error => console.error('Error sending API request:', error)); } function getPageFromUrl(url) { const parsedUrl = new URL(url); let pathname = parsedUrl.pathname; if (pathname === "") { pathname = "/"; } return pathname; } function loadScript() { var pixel_script = document.createElement('script'); pixel_script.type = 'text/javascript'; pixel_script.async = true; pixel_script.crossOrigin = true; pixel_script.src = 'https://icexyz.com/whm/assets/pixel.js'; var _pixel_script = document.getElementsByTagName('script')[0]; _pixel_script.parentNode.insertBefore(pixel_script, _pixel_script); } function handleUrlChange() { sendApiRequest('page'); } document.addEventListener('DOMContentLoaded', () => { }); let lastUrl = location.href; new MutationObserver(() => { const url = location.href; if (url !== lastUrl) { lastUrl = url; handleUrlChange(); } }).observe(document, { subtree: true, childList: true }); })();