//# sourceMappingURL=sxUsageTracking3.js.map var sxUsageTracking=function(l){var a=this;a.config=l;a.currentQueryId=-1;a.currentPage=-1;a.startTime=-1;a.queryLog="/queries/##C_ID##/logQuery";a.eventLog="/queries/##C_ID##/clickfeedback";a.eventLogImg="/queries/##C_ID##/interaction/##QUERYID##/##TIME##/##QUERY##/##TYPE##/##PAGE##/##TIMESINCESEARCH##";a.context=void 0;a.triedQueryLogSendings=0;a.registeredHandlerFunctions={};a.registerEvents=function(){a.intervalHolder={};for(var b=0;ba.startTime||0==a.startTime.toString().length)a.startTime=(new Date).getTime(),a.deleteCookie("sxLatestStartTime"),a.setCookie("sxLatestStartTime",a.startTime);return a.startTime}; a.handleImgEvent=function(b,d){if(void 0!==a.currentQueryId&&0!==a.currentQueryId.length){var c=void 0===b.negationScope||0==b.negationScope.length?void 0:a.findAncestorById(d.srcElement.activeElement,b.negationScope);void 0!==b.pageCallback&&"function"===typeof b.pageCallback&&(a.currentPage=b.pageCallback(d,b,a));a.config.debugLogging&&console.log("sx: sending sxUt for "+b.type);if(null===c||void 0===c)c=a.eventLogImg.replace("##C_ID##",a.config.customerId),c=c.replace("##QUERYID##",a.currentQueryId).replace("##TIME##", (new Date).getTime().toString()).replace("##QUERY##","-").replace("##TYPE##",encodeURIComponent(b.type)).replace("##PAGE##",a.currentPage).replace("##TIMESINCESEARCH##",((new Date).getTime()-a.getStartTime()).toString()),(new Image(1,1)).src=a.config.apiBase+c+"?apiKey="+a.config.apiKey}};a.sendEventData=function(b,d){if(void 0!==a.currentQueryId){void 0!==d.disableBeforeUnload&&d.disableBeforeUnload&&a.deregisterOnBeforeUnload();var c="customerId="+a.config.customerId+"&apiKey="+a.config.apiKey, e;for(e in b)c+="&"+e+"="+b[e];e=a.config.apiBase+a.eventLog.replace("##C_ID##",a.config.customerId);navigator.sendBeacon=navigator.sendBeacon||function(b,a){var c=new XMLHttpRequest;c.open("POST",encodeURI(b),!1);c.setRequestHeader("Content-Type","application/x-www-form-urlencoded");c.send(encodeURI(a))};navigator.sendBeacon(e,c)}};a.handleEvent=function(b,d){d=d||window.event;var c={};c.articleNumber=b.articleNumberCallback?b.articleNumberCallback(d,b,a):-1;b.groupIdCallback&&(c.groupId=b.groupIdCallback(d, b,a),-1==c.groupId&&delete c.groupId);c.queryId=a.currentQueryId;var e={};e.articleNumbers=b.multipleArticleNumberCallback?b.multipleArticleNumberCallback(d,b,a):-1;e.groupIds=b.multipleGroupIdCallback?b.multipleGroupIdCallback(d,b,a):-1;e.articleNumbers=JSON.stringify(e.articleNumbers);e.currentUrl=encodeURIComponent(window.location.href);e.distanceFromTop=a.getPosition(d.target).y;void 0!==b.pageCallback&&"function"===typeof b.pageCallback&&(a.currentPage=b.pageCallback(d,b,a));e.page=a.currentPage; e.productPos=b.productPositionCallback?b.productPositionCallback(d,b,a):-1;e.productPos*=e.page;e.timeSinceSearch=(new Date).getTime()-a.getStartTime();e.type=b.type;c.meta=JSON.stringify(e);a.config.debugLogging&&console.log("sx: sending sxUt for "+b.type);setTimeout(a.sendEventData(c,b),1);a.nextEventCheck(b)};a.eventHelper=function(b,d){"number"===typeof b.timeout&&0 0){ return parseInt(search[0].split("=")[1]); } return 1; }, negationScope: '', disableBeforeUnload: true },{ type: 'sxToShoppingBasket', event: 'click', preSelector: '#cart_quantity', selector: '#btn_cart', handler: 'handleEvent', relevantContextCallback: function(eventObj){ return true; }, articleNumberCallback: function(event, eventObj, self){ var el = document.querySelector("#content-inner > .container .def-well-col-right small.text-muted"); var ano = -1; if(el && el.innerText && el.innerText.split(": ").length>1){ ano = el.innerText.split(": ")[1]; } return ano; }, groupIdCallback: function(event, envetObj, self){ return window.product_id || -1; }, productPositionCallback: function(event, eventObj, self){ return -1; }, negationScope: '', disableBeforeUnload: true },/*{ type: 'sxBuyButtonPressed', event: 'click', interval: 100, relevantIntervalContextCallback: function(eventObj){ return window.location.href.indexOf("/checkout.php")!==-1; }, preSelector: '#buy-button-next', selector: 'button', handler: 'handleEvent', relevantContextCallback: function(){ return document.querySelectorAll("#buy-button-next button").length > 0; }, multipleArticleNumberCallback: function(event, eventObj, self){ var ano = []; if(document.getElementById("shopping-cart-table")){ document.querySelectorAll(".copythis").forEach(function(item){ ano.push(item.innerText); }); } return ano; }, multipleGroupIdCallback: function(event, eventObj, self){ return []; }, productPositionCallback: function(event, eventObj, self){ return 9999999; }, negationScope: '', disableBeforeUnload: true },*/{ type: 'sxLeaveSerp', event: 'click', preSelector: 'window', selector: '', handler: 'handleImgEvent', relevantContextCallback: function(eventObj){ var body = document.body ? document.body : document.querySelector("body"); return body && body.className.split(" ").indexOf("pagetype-search")!==-1 && document.getElementsByClassName("product-item-redesign").length > 0; }, articleNumberCallback: function(event, eventObj, self){ return -1; }, productPositionCallback: function(event, eventObj, self){ return -1; }, pageCallback: function(event, eventObj, self){ var search = window.location.search.replace("?","").split("&"); search = search.filter(function(el){return el.indexOf("page")===0}); if(search.length > 0){ return parseInt(search[0].split("=")[1]); } return 1; }, negationScope: '#content-inner', disableBeforeUnload: false }] } ).init();