https://www.candy-home.com/cs_CZ/cdn/shop/t/2/assets/he-global-cus…?v=142125935432759854181783426616
1const logger={level:"info",_levels:{debug:0,info:1,error:2},debug(label,...args){this._levels[this.level]<=0&&console.log("[DEBUG]",label,...args)},info(label,...args){this._levels[this.level]<=1&&console.info("[INFO]",label,...args)},error(label,...args){this._levels[this.level]<=2&&console.error("[ERROR]",label,...args)}},scrollPublished={25:!1,50:!1,75:!1,99:!1};function safePathname(href){try{return new URL(href,window.location.origin).pathname}catch{return null}}function getCleanText(element,maxLength=500){return!element||!element.textContent?"":element.textContent.replace(/\s+/g," ").trim().substring(0,maxLength)}function getElementPath(element,mode){if(!(element instanceof Node))return null;var elList=[],el=element;do{if(el instanceof Element){var attribute="";if(mode==="style")attribute=el.style&&el.style.cssText?"[style='"+el.style.cssText+"']":"";else{var classString=el.classList?[].slice.call(el.classList).join("."):"";attribute=classString?"."+classString:""}var id=el.id?"#"+el.id:"",tag=el.tagName?el.tagName.toLowerCase():"",elementName=tag+attribute+id;elementName&&elList.unshift(elementName)}el=el.parentNode}while(el!=null);var raw=element.toString(),objString=raw.match(/\[object (\w+)\]/),elementType=objString?objString[1]:raw,cssString=elList.join(" > ");return cssString?elementType+": "+cssString:elementType}function isPDPLink(href){const pathname=safePathname(href);return pathname&&/\/products\/\d{8}-[a-z0-9-]+$/i.test(pathname)}function extractSku(pathname){const handle=pathname.split("/").pop();if(!handle)return null;const sku=handle.split("-")[0];return/^\d{8}$/.test(sku)?sku:null}function getSectionType(inputUrl){if(!inputUrl)return null;let urlObj;try{urlObj=new URL(inputUrl)}catch{return null}const pathname=urlObj.pathname,search=urlObj.search||"";if(pathname==="/"||/^\/[a-z]{2}_[A-Z]{2}\/?$/.test(pathname))return 1;if(pathname.includes("/cs_CZ/collections/"))return 2;const productMatch=pathname.match(/\/products\/([^\/]+)/);if(productMatch){const sku=productMatch[1].split("-")[0];if(/^\d{8}$/.test(sku))return 3}return/\/search\?.*q=[^&]+/i.test(pathname+search)?4:null}function storeProductSection(href,context=document){if(!isPDPLink(href))return;const SKU=extractSku(safePathname(href));if(!SKU)return;const sectionType=getSectionType(window.location.href);sectionType!=null&&sessionStorage.setItem("item_"+SKU,sectionType)}function waitForNextBuyNowEvent(action,timeout=1e3,interval=50){return new Promise(resolve=>{if(!window.dataLayer){resolve(null);return}const initialLength=window.dataLayer.length,startTime=Date.now(),timer=setInterval(()=>{for(let i=initialLength;i<window.dataLayer.length;i++){const ev=window.dataLayer[i];if(ev&&ev.event==="BuyNowEvent"&&ev.action===action){clearInterval(timer),resolve(ev);return}}Date.now()-startTime>timeout&&(clearInterval(timer),resolve(null))},interval)})}function isForm(event){const target=event.target;if(!target||target.type!=="submit")return null;const form=target.closest("form");return!form||form.getAttribute("action")==="/cs_CZ/cart/add"?null:form}function publishEvent(eventName,element,extra={}){try{const payload=buildClickPayload(element,extra);Shopify.analytics.publish(eventName,payload),logger.debug(`publishEvent - ${eventName}`,payload)}catch(e){logger.error(`publishEvent - ${eventName} failed`,e)}}function buildClickPayload(element,extra={}){const closestLink=element.closest?.("a"),closestButton=element.closest?.("button");let sourceElement=element;closestLink?sourceElement=closestLink:closestButton&&(sourceElement=closestButton);const payload={click_element:getElementPath(sourceElement,"class")||"",click_style:getElementPath(sourceElement,"style")||"",click_id:sourceElement.id||"",click_name:sourceElement.name||"",click_classes:sourceElement.classList?Array.from(sourceElement.classList).join(" "):"",click_text:getCleanText(sourceElement),page_url:window.location.href};return closestLink&&(payload.click_url=closestLink.href||"",payload.click_target=closestLink.target||""),closestButton&&(payload.button_type=closestButton.type||"",payload.click_sku=closestButton.dataset?.productSku||""),{...payload,...extra}}
1document.addEventListener("DOMContentLoaded",()=>{const breadcrumbItems=document.querySelectorAll(".product-breadcrumbs__list li"),trail=Array.from(breadcrumbItems).map(el=>el.textContent.trim());if(trail.length===0||!Shopify?.analytics?.publish)return;const breadcrumbTrail=trail.join(" > ");try{const payload={breadcrumb_trail:breadcrumbTrail,slug:window.location.href};Shopify.analytics.publish("dom_ready_shp",payload),logger.debug("[DOMContentLoaded Listener] - dom_ready_shp",payload)}catch(e){logger.error("[DOMContentLoaded Listener] - dom_ready_shp failed",e)}}),document.addEventListener("click",function(event){const target=event.target;if(!target)return;const closestLink=event.target.closest("a"),closestButton=event.target.closest("button");if(!event.target.closest("details.filter")){if(logger.debug("click",{event,target,closestLink,closestButton}),closestLink){if(storeProductSection(closestLink.href),closestLink.classList.contains("cs_buynow-button")){waitForNextBuyNowEvent("clickToRetailer").then(ev=>{ev&&publishEvent("he_custom_wtb_retailer",target,{wtb_action:ev.action||"",wtb_brand:ev.brandName||"",wtb_category:ev.category||"",wtb_label:ev.label||"",wtb_product_detail:ev.productDetail||"",wtb_retailer:ev.retailer||"",wtb_value:ev.value||""})});return}publishEvent("he_custom_click",target);return}if(closestButton){if(closestButton.classList.contains("cswidget")){waitForNextBuyNowEvent("open").then(ev=>{ev&&publishEvent("he_custom_wtb_open",target,{wtb_action:ev.action||"",wtb_brand:ev.brandName||"",wtb_category:ev.category||"",wtb_label:ev.label||"",wtb_product_detail:ev.productDetail||""})});return}const eventForm=isForm(event);if(eventForm){publishEvent("he_custom_form_submit",target,{form_class:eventForm.className});return}publishEvent("he_custom_button_click",target);return}publishEvent("he_custom_ui_element_click",target)}},!0),document.addEventListener("change",event=>{const input=event.target,closestDetails=input.closest("details.filter");if(!closestDetails)return;const filterType=closestDetails.dataset.type,filterId=closestDetails.dataset.id;let filterValue="";switch(filterType){case"radio":case"box":const radioSelected=closestDetails.querySelector(`input[type="radio"][name="${filterId}"]:checked`);filterValue=radioSelected?.dataset?.value||radioSelected?.value;break;case"range":const minInput=closestDetails.querySelector('input[data-range="min"]'),maxInput=closestDetails.querySelector('input[data-range="max"]'),minValue=minInput?.value,maxValue=maxInput?.value;filterValue=`${minValue??""}-${maxValue??""}`;break;case"checkbox":if(!input.checked)return;const checkboxSelected=closestDetails.querySelectorAll(`input[type="checkbox"][name="${filterId}"]:checked`);filterValue=Array.from(checkboxSelected).map(input2=>input2.value).join(",");break;default:filterValue="";break}if(filterValue.length){publishEvent("he_custom_filter_click",input,{filter_id:filterId,filter_value:filterValue,filter_type:filterType});return}},!0),document.addEventListener("scroll",function(){const scrollTop=window.scrollY,docHeight=document.documentElement.scrollHeight-window.innerHeight;if(docHeight<=0)return;const scrollPercent=scrollTop/docHeight*100;[25,50,75,99].forEach(function(threshold){if(scrollPercent>=threshold&&!scrollPublished[threshold]){scrollPublished[threshold]=!0;try{const payload={percent_scrolled:threshold};Shopify.analytics.publish("scroll",payload),logger.debug("[scroll Listener] - scroll",payload)}catch(e){scrollPublished[threshold]=!1,logger.error("[scroll Listener] - scroll failed",e)}}})}),document.addEventListener("visibilitychange",e=>{if(logger.info("Listener visibilitychange - state :",document.visibilityState),document.visibilityState=="hidden"){const timestamp=sessionStorage.getItem("event_timestamp");if(timestamp){const ms=Date.now()-parseInt(timestamp,10);if(ms>=1e3)try{const payload={engagement_time_msec:ms};Shopify.analytics.publish("user_engagement",payload),logger.debug("[visibilitychange Listener] - user_engagement",payload)}catch(e2){logger.debug("[visibilitychange Listener] - user_engagement failed",e2)}}sessionStorage.removeItem("event_timestamp")}else document.visibilityState=="visible"&&sessionStorage.setItem("event_timestamp",Date.now())}),document.addEventListener("pagehide",e=>{logger.info("Listener pagehide");const timestamp=sessionStorage.getItem("event_timestamp");if(timestamp){const ms=Date.now()-parseInt(timestamp,10);if(ms>=1e3)try{const payload={engagement_time_msec:ms};Shopify.analytics.publish("user_engagement",payload),logger.debug("[pagehide Listener] - user_engagement",payload)}catch(e2){logger.error("[pagehide Listener] - user_engagement failed",e2.message)}sessionStorage.removeItem("event_timestamp")}}); 2//# sourceMappingURL=/cdn/shop/t/2/assets/he-global-custom-tracking.js.map?v=142125935432759854181783426616
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.