if (!window._mpPost) { transPageChange(); } function transPageChange(transEmail, transCustomFields, transGroupId, nHost, nOrigin, nUuid) { var o = transGetId(); let dReferrer = ""; if (document && document.referrer) dReferrer = document.referrer; var e = { id: nUuid || o, am: 'MTIxMA==', host: nHost || document.location.host, origin: nOrigin || document.location.origin, pathname: document.location.pathname, query: document.location.search, hash: document.location.hash, referrer: nOrigin || dReferrer }; if (transEmail) e.emailAddress = transEmail if (transCustomFields) e.customFields = transCustomFields; if (transGroupId) e.groupId = transGroupId; e = mpCheckLocalVars(e); mpPostData(e); } function transGetId() { let mpCookieFound = undefined; var mp_allCookies = document.cookie; var mp_cookiesArray = mp_allCookies.split(';'); for (var i = 0; i < mp_cookiesArray.length && mpCookieFound == undefined; i++) { var mpCookie = mp_cookiesArray[i].trim(); if (mpCookie.indexOf('mpz=') === 0) { mpCookieFound = mpCookie.substring(4); } } if(mpCookieFound == undefined) { document.cookie = "mpz=d77e9d2a-24e9-44fe-bb3c-a1bfaf269385;expires=Fri, 31 Dec 9999 23:59:59 GMT;lSameSite=Lax;Path=/;"; mpCookieFound = "d77e9d2a-24e9-44fe-bb3c-a1bfaf269385"; } return mpCookieFound; }; var mpJqAtt = 0; function manualTracking(nPath,nQs,nEmail,nCfields,nGroupId,nEventName,nEventData, nUuid, nHost, nOrigin) { var e = { id: nUuid || transGetId(), am: 'MTIxMA==', host: nHost || document.location.host, origin: nOrigin || document.location.origin, pathname: nPath || document.location.pathname, query: nQs || document.location.search, hash: document.location.hash }; e = mpCheckLocalVars(e) if (nEmail) { e.emailAddress = nEmail } if (nCfields) { e.customFields = nCfields } if (nGroupId) { e.groupId = nGroupId } if(nEventName) { e.eventName = nEventName; } if(nEventData) { e.eventData = nEventData; } mpPostData(e); } function mpPostData(e) { var finalTrackerUrl = 'https://api.transpond.io/tracker'; var xmlhttp if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("POST", finalTrackerUrl); xmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); xmlhttp.send(JSON.stringify(e)) } function mpCheckLocalVars(vars) { if (typeof mpGroupId !== 'undefined') { vars.groupId = mpGroupId } if (typeof mpEmailAddress !== 'undefined') { if (mpEmailAddress.length && mpEmailAddress.indexOf(".") && mpEmailAddress.indexOf("@")) { vars.emailAddress = mpEmailAddress } } if (typeof mpCustomFields !== 'undefined') { if (typeof mpCustomFields == "object") { vars.customFields = mpCustomFields } } if (typeof mpPath !== 'undefined') { vars.pathname = mpPath; } if (typeof mpQuery !== 'undefined') { vars.query = mpQuery; } return vars; } window._mpPost = manualTracking;