window.dataLayer = window.dataLayer || []; var defaultEventAttr = { 'application_id': '6307440e7e6967118bf78d4e', }; const getHost = () => { if (window.frameElement !== null) { return window.frameElement.getAttribute('src'); } return window.location.href; } let iIdual = (event) => { if (event.user_id && event.oc_visitor_id) { fetch('https://onecommerce.io/t/api/v1/identify-user', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({...event, event: 'identify_user', host: getHost()}) }) } window.dataLayer.push(event); } function iIual(event) { if (defaultEventAttr.oc_visitor_id === undefined) { import('https://onecommerce.io/t/assets/fingerprintjs.js').then(FingerprintJS => FingerprintJS.load()).then(fp => fp.get()).then(visitor => { defaultEventAttr.oc_visitor_id = visitor.visitorId; iIdual(Object.assign({}, defaultEventAttr, event)); }); } else { iIdual(Object.assign({}, defaultEventAttr, event)); } } if (window.oneLayer) { window.oneLayer.forEach(iIual); } window.oneLayer = { push: iIual }; (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-T292NLK');