PageSourceSearch

https://www.reebok.com/cdn/shop/t/740/assets/promotion-tracking.js?v=166516543740317240761790699382

js reebok.com collected 2026-10-02 02:28:14 UTC 8,493 bytes, 2 lines download raw bytes

1window.promotionElements=[];var start=new Date;function debouncer(func,wait=500,immediate=!0){let timeout;return function(){let context=this,args=arguments,later=function(){timeout=null,immediate||func.apply(context,args)},callNow=immediate&&!timeout;clearTimeout(timeout),timeout=setTimeout(later,wait),callNow&&func.apply(context,args)}}function checkIfPromotionsAreInview(){const promotionElements=window.promotionElements,visiblePromotions=[];promotionElements.forEach(item=>{elementIsVisibleInViewport(item)&&elementIsVisible(item)&&!item.hasAttribute("data-tracked")&&(visiblePromotions.push(item),item.setAttribute("data-tracked",!0))}),trackPromotionImpressions(visiblePromotions)}function checkIfSearchResultsAreInview(){const searchElement=document.querySelectorAll("#fs-collection-products .product__grid__info"),visibleResults=[];return searchElement.forEach(item=>{elementIsVisibleInViewport(item)&&elementIsVisible(item)&&!item.hasAttribute("data-tracked")&&(visibleResults.push(item),item.setAttribute("data-tracked",!0))}),visibleResults}function elementIsVisible(elem){try{return!!elem.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0,contentVisibilityAuto:!0})}catch{console.log("fallback:checkVisibility")}return!0}function elementIsVisibleInViewport(elem,partiallyVisible=!1){const{top,left,bottom,right}=elem.getBoundingClientRect(),{innerHeight,innerWidth}=window;return partiallyVisible?(top>0&&top<innerHeight||bottom>0&&bottom<innerHeight)&&(left>0&&left<innerWidth||right>0&&right<innerWidth):top>=0&&left>=0&&bottom<=innerHeight&&right<=innerWidth}function trackPromotionImpressions(promotionElements){const promotions=Array.from(promotionElements).map(element=>({promotion_id:element.getAttribute("data-promotion_id").replace(/<[^>]*>/g,"").replace(/[^0-9a-z]/gi,""),promotion_name:element.getAttribute("data-promotion_name").replace(/<[^>]*>/g,"").replace(/[^0-9a-z]/gi,""),promotion_creative:element.getAttribute("data-promotion_creative").replace(/<[^>]*>/g,"").replace(/[^0-9a-z]/gi,""),promotion_position:window.siteGlobals.pageType+"-"+element.getAttribute("data-promotion_position").replace(/<[^>]*>/g,"").replace(/[^0-9a-z]/gi,""),promotion_theme:window.Shopify?.theme?.name||""}));promotions.length>0&&window.ElevarDataLayer.push({event:"promotion_impression",ecommerce:{promoView:{promotions}}})}function trackPromotionClick(promotionData){window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"promotion_click",ecommerce:{promoClick:{promotions:[promotionData]}}}),window.setPromoClick(JSON.stringify(promotionData))}function attachPromotionListeners(){window.promotionElements.forEach(element=>{element.addEventListener("click",()=>{const promotionData={promotion_id:element.getAttribute("data-promotion_id").replace(/<[^>]*>/g,"").replace(/[^0-9a-z]/gi,""),promotion_name:element.getAttribute("data-promotion_name").replace(/<[^>]*>/g,"").replace(/[^0-9a-z]/gi,""),promotion_creative:element.getAttribute("data-promotion_creative").replace(/<[^>]*>/g,"").replace(/[^0-9a-z]/gi,""),promotion_position:window.siteGlobals.pageType+"-"+element.getAttribute("data-promotion_position").replace(/<[^>]*>/g,"").replace(/[^0-9a-z]/gi,""),promotion_theme:window.Shopify?.theme?.name||""};debouncer(trackPromotionClick(promotionData),10)})})}function waitForElevarDataLayer(maxAttempts=20,interval=250){return new Promise((resolve,reject)=>{let attempts=0;const checkElevar=()=>{attempts++,typeof ElevarDataLayer<"u"?resolve():attempts>=maxAttempts?reject(new Error("Elevar DataLayer not available after maximum attempts")):setTimeout(checkElevar,interval)};checkElevar()})}waitForElevarDataLayer().then(()=>{updateCustomDataLayer()}).catch(error=>{console.error("Failed to detect Elevar DataLayer:",error)});function updateCustomDataLayer(){var time=new Date-start;window.promotionElements=document.querySelectorAll("[data-promotion_id]"),checkIfPromotionsAreInview(),window.addEventListener("scroll",debouncer(checkIfPromotionsAreInview)),attachPromotionListeners()}function handleSearchResultsClick(fsProd){const userProperties={};window.ElevarDataLayer.push({event:"dl_select_item",user_properties:userProperties,ecommerce:{actionField:{click:{actionField:{list:window.location.pathname},products:convertFSProductToClick(fsProd)}}}})}function convertFSProductToClick(fsProd){var items=[],result=document.querySelector('[pid="'+fsProd+'"]');if(result){var titleElement=result.querySelector(".product__grid__title"),dataElement=result.querySelector(".product__grid__title__wrapper");items.push({id:titleElement.getAttribute("id").replace("product-","")||"",name:titleElement.textContent.trim()||"",brand:dataElement.getAttribute("data-vendor"),optionOne:dataElement.getAttribute("data-color"),optionTwo:"",optionThree:"",category:dataElement.getAttribute("data-product-type"),price:dataElement.getAttribute("data-price")||"0",compare_at_price:dataElement.getAttribute("data-compare-price")||"0",product_id:titleElement.getAttribute("id").replace("product-","")||"",position:dataElement.getAttribute("data-placement")})}return items}function handleSearchResultsView(searchTerm,count){if(typeof ElevarDataLayer<"u"){const userProperties={},items=checkIfSearchResultsAreInview();if(items.length){let userProperties2={};window.ElevarDataLayer.push({event:"dl_view_search_results",user_properties:userProperties2,ecommerce:{currencyCode:"USD",actionField:{list:"search results:"+searchTerm},impressions:getSearchResultItems(items)}})}}}function getSearchResultItems(searchItems){for(var items=[],searchResults=searchItems,i=0;i<searchResults.length;i++){var result=searchResults[i],titleElement=result.querySelector(".product__grid__title"),dataElement=result.querySelector(".product__grid__title__wrapper");items.push({id:titleElement.getAttribute("id").replace("product-","")||"",name:titleElement.textContent.trim()||"",brand:dataElement.getAttribute("data-vendor"),optionOne:dataElement.getAttribute("data-color"),optionTwo:"",optionThree:"",category:dataElement.getAttribute("data-product-type"),price:dataElement.getAttribute("data-price")||"0",compare_at_price:dataElement.getAttribute("data-compare-price")||"0",product_id:titleElement.getAttribute("id").replace("product-","")||"",position:dataElement.getAttribute("data-placement")})}return items}
1window.setPromoClick=function(pc){localStorage.setItem("promoclick",pc);let promoclick=localStorage.getItem("promoclick")},window.getPromoClick=function(){let promoclick=localStorage.getItem("promoclick")||[],results=[];try{results=JSON.parse(promoclick)}catch{}return results},window.resetPromoClick=function(){localStorage.removeItem("promoclick");let findMethod=localStorage.getItem("promoclick")||""},window.setFindingMethod=function(fm){localStorage.setItem("findingMethod",window.siteGlobals.pageType+"-"+fm);let findMethod=localStorage.getItem("findingMethod")},window.updateFindingMethod=function(fm){(window.getFindingMethod()===null||window.getFindingMethod()==="")&&window.setFindingMethod(fm)},window.getFindingMethod=function(){return localStorage.getItem("findingMethod")||""},window.resetFindingMethod=function(){localStorage.removeItem("findingMethod");let findMethod=localStorage.getItem("findingMethod")||""},window.setLastClickPromotion=function(promotion){try{sessionStorage.setItem("lastClickPromotion",JSON.stringify(promotion))}catch(e){console.error("Error setting last click promotion:",e)}},window.getLastClickPromotion=function(){try{let storedPromotion=sessionStorage.getItem("lastClickPromotion");return storedPromotion?JSON.parse(storedPromotion):""}catch(e){return console.error("Error getting last click promotion:",e),null}},window.resetLastClickPromotion=function(){sessionStorage.removeItem("lastClickPromotion")},window.setPDPProductTrackingDetails=function(pdetails){window.productDetails=pdetails},window.clearPDPProductTrackingDetails=function(){window.productDetails=[]};function getPromotionData(element){return{promotion_id:element.getAttribute("data-promotion_id")||"",promotion_name:element.getAttribute("data-promotion_name")||"",creative:element.getAttribute("data-promotion_creative")||"",position:element.getAttribute("data-promotion_position")||""}}function findNearestPromotionElement(element){for(;element&&element!==document.body;){if(element.hasAttribute("data-promotion_id"))return element;element=element.parentElement}return null}
2//# sourceMappingURL=/cdn/shop/t/740/assets/promotion-tracking.js.map?v=166516543740317240761790699382

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.