w = (function () {var websiteId, tcMicroserviceUrl, onWebsiteVisitNotified; function getWebsiteInteractionUrl(interactionType) { return tcMicroserviceUrl + "/" + interactionType + "/" + websiteId + "?ad=" + encodeURIComponent(document.location.toString()) + "&rf=" + encodeURIComponent(document.referrer) }; function appendLinkInfo(websiteInteractionUrl, tg, fn) { return websiteInteractionUrl + "&tg=" + encodeURIComponent(tg) + "&fn=" + encodeURIComponent(fn) }; function appendRandomId(websiteInteractionUrl) { return websiteInteractionUrl + "&id=" + encodeURIComponent(Math.floor(Math.random() * 9999999999).toString()) }; function performImageRequest(imgSrc, onImageLoaded) { var image = new Image; image.id = "i" + websiteId; image.width = 0; image.height = 0; image.src = imgSrc; image.onload = function () { var imgContainer = document.getElementById("d" + websiteId); if (imgContainer) { imgContainer.style.width = "0px"; imgContainer.style.height = "0px"; imgContainer.appendChild(image) } if (typeof onImageLoaded === "function") { onImageLoaded() } } }; function requestWebsiteVisited() { performImageRequest(appendRandomId(getWebsiteInteractionUrl("v")), onWebsiteVisitNotified) }; function requestWebsiteClicked(linkHref, linkText) { performImageRequest(appendRandomId(appendLinkInfo(getWebsiteInteractionUrl("l"), linkHref, linkText)), null) }; function onClick(ev) { if (ev.button === 0 || ev.button === 1) { var t = ev.target; while (t && t.tagName !== "A") { t = t.parentElement || t.parentNode } if (t && t.getAttribute("data-msdyn-tracking") !== "false") { var ch = t.firstElementChild; requestWebsiteClicked(t.href, ch && (ch.alt || ch.title || ch.src) || t.text || t.innerText) } } }; function listenClicks() { if (document.body.addEventListener) { var eventName = navigator.appVersion.indexOf("MSIE") === -1 ? "mousedown" : "click"; document.body.addEventListener(eventName, onClick) } }; return { w: function (wid, srv, c) { websiteId = wid; tcMicroserviceUrl = srv; onWebsiteVisitNotified = c; requestWebsiteVisited(); listenClicks() } }})();