1if(typeof breadcrumb!=="undefined"){let breadcrumb={value:undefined,}} 2if(typeof user!=="undefined"){let user={userId:undefined,lastLogin:undefined,firstLogin:undefined,lastPurchase:undefined,}} 3const form=document.getElementById("gform_1");if(form){form.addEventListener("submit",gtag_report_conversion_newsletter)} 4function gtag_report_conversion_newsletter(){var callback=function(){if(typeof url!="undefined"){window.location=url}};gtag("event","conversion",{send_to:"AW-691985440/bOKACNnJzPkBEKC4-8kC",event_callback:callback,});if(document.documentElement.lang!=="pt-PT"){pintrk("track","lead",{lead_type:"Newsletter",})} 5return!1} 6function getProductDataById(itemKey,type="analytic-product"){let products=document.querySelectorAll("[data-"+type+'-id="'+itemKey+'"]',);if(products.length<1){return} 7let product=products[0];if(type==="analytic-product"){return{name:product.dataset.analyticProductName,id:product.dataset.analyticProductId,price:product.dataset.analyticProductPrice,category:product.dataset.analyticProductCategory,variant:product.dataset.analyticProductCategories,quantity:product.dataset.analyticProductQuantity,position:product.dataset.analyticProductPosition,list:undefined,}}else{return{name:product.dataset.analyticCartProductName,id:product.dataset.analyticCartProductId,price:product.dataset.analyticCartProductPrice,category:product.dataset.analyticCartProductCategory,variant:product.dataset.analyticCartProductCategories,quantity:product.dataset.analyticCartProductQuantity,position:product.dataset.analyticCartProductPosition,list:undefined,}}} 8function getProductData(product){return{name:product.name,id:product.id,price:product.price,category:product.category,variant:product.categories,quantity:product.quantity,list:undefined,position:undefined,}} 9function getListHomeProductByList(list){let products=[];let listProducts=document.querySelectorAll(".slick-active .ficha-producto");if(listProducts){for(var i=0;i<listProducts.length;i++){var product=getProductDataById(listProducts[i].dataset.analyticProductId,);if(product){product.list="home - "+list;products.push(product)}}} 10return products} 11function eventLoadHome(){let ofertas=getListHomeProductByList("#ofertas");let motosierras=getListHomeProductByList("motosierras");let cortacespedes=getListHomeProductByList("cortacéspedes");let desbrozadoras=getListHomeProductByList("desbrozadoras");var event={event:"eventoEC",eventCat:"ecommerce",eventAct:"productImpresion",eventLbl:"home",noInteraction:"true",ecommerce:{currencyCode:"EUR",impressions:[...ofertas,...motosierras,...cortacespedes,...desbrozadoras,],},};window.dataLayer.push(event)} 12function eventLoadProductPage(){if(typeof product!=="undefined"){let event={event:"eventoEC",eventCat:"ecommerce",eventAct:"detail",eventLbl:product.name,noInteraction:!0,ecommerce:{currencyCode:"EUR",detail:{actionField:{list:breadcrumb.value},products:[{name:product.name,id:product.id,price:product.price,brand:"Husqvarna",category:product.category,variant:product.categories,},],},},};window.dataLayer.push(event);if(document.documentElement.lang!=="pt-PT"){if(typeof fbq!=="undefined"){fbq("track","ViewContent",{value:product.price,currency:"EUR",content_ids:product.id,content_type:product.category,})}}}} 13function eventLoadCategoryPage(config){let listProducts=document.getElementsByClassName("ficha-producto");let products=[];let list="";if(listProducts){if(config.order){list+="Ordenar "+config.order} 14if(config.price){list+=" Filtro precio "} 15if(config.search){list+="Busqueda interna "+config.search+" "} 16if(config.categories.length>0){list+=config.categories.join(" - ")}else{list+=breadcrumb.value} 17for(var i=0;i<listProducts.length;i++){var product=getProductDataById(listProducts[i].dataset.analyticProductId,);if(product){product.list=list;products.push(product)}}} 18let event={event:"eventoEC",eventCat:"ecommerce",eventAct:"productImpresion",eventLbl:breadcrumb.value,noInteraction:"true",ecommerce:{currencyCode:"EUR",impressions:products,},};window.dataLayer.push(event);if(config.search&&document.documentElement.lang!=="pt-PT"){if(typeof fbq!=="undefined"){fbq("track","Search")}} 19if(config.search){var callback=function(){("gtag buscador");if(typeof url!="undefined"){window.location=url}};gtag("event","conversion",{send_to:"AW-691985440/FTs3CJ3GzPkBEKC4-8kC",event_callback:callback,})}("eventLoadCategoryPage",event)} 20function eventLoadCheckoutPage(){let productsList=[];
20if(typeof products!=="undefined"){for(var i=0;i<products.length;i++){productsList.push(getProductData(products[i]))} 21let event={event:"eventoEC",eventCat:"ecommerce",eventAct:"checkout-2",eventLbl:"datos de facturacion",noInteraction:"true",ecommerce:{currencyCode:"EUR",checkout:{actionField:{step:2},products:productsList,},},};("eventLoadCheckoutPage",event);window.dataLayer.push(event)}} 22function eventClickProduct(product,position){let event={event:"eventoEC",eventCat:"ecommerce",eventAct:"productClick",eventLbl:breadcrumb.value,ecommerce:{click:{actionField:{list:breadcrumb.value,},products:[{name:product.name,id:product.id,price:product.price,brand:"Husqvarna",category:product.category,variant:product.categories,list:breadcrumb.value,position:position,},],},},};("eventClickProduct",event);window.dataLayer.push(event)} 23function eventClickAddCart(product,position,quantity,dimension6){let event={event:"eventoEC",eventCat:"ecommerce",eventAct:"addToCart",eventLbl:product.name,ecommerce:{currencyCode:"EUR",add:{products:[{name:product.name,id:product.id,price:product.price,brand:"Husqvarna",category:product.category,variant:product.categories,dimension6:dimension6,quantity:quantity,list:breadcrumb.value,position:product.position?product.position:position,},],},},};if(document.documentElement.lang!=="pt-PT"){pintrk("track","addtocart",{value:product.price,order_quantity:quantity,currency:"USD",});if(typeof fbq!=="undefined"){fbq("track","AddToCart",{value:product.price,currency:"EUR",contents:[{id:product.id,quantity:quantity,},],content_ids:product.id,})}} 24window._adftrack=Array.isArray(window._adftrack)?window._adftrack:window._adftrack?[window._adftrack]:[];window._adftrack.push({HttpHost:"track.adform.net",pm:2316232,divider:encodeURIComponent("|"),pagename:encodeURIComponent("Añadir al carro"),order:{sales:product.price,orderid:product.id,itms:[{categoryname:product.category,productname:product.name,productid:product.id,productcount:quantity,productsales:product.price,},],},});(function(){var s=document.createElement("script");s.type="text/javascript";s.async=!0;s.src="https://s2.adform.net/banners/scripts/st/trackpoint-async.js";var x=document.getElementsByTagName("script")[0];x.parentNode.insertBefore(s,x)})();("eventClickAddCart",event);window.dataLayer.push(event);var callbackAdd=function(){("gtag add to cart");if(typeof url!="undefined"){window.location=url}};gtag("event","conversion",{send_to:"AW-691985440/m_TWCNiQ7_kBEKC4-8kC",event_callback:callbackAdd,});return!1} 25function eventClickRemoveCart(product,position,quantity,dimension6){let event={event:"eventoEC",eventCat:"ecommerce",eventAct:"removeFromCart",eventLbl:product.name,ecommerce:{currencyCode:"EUR",remove:{products:[{name:product.name,id:product.id,price:product.price,brand:"Husqvarna",category:product.category,variant:product.categories,dimension6:dimension6,quantity:quantity,list:breadcrumb.value,},],},},};("eventClickRemoveCart",event);window.dataLayer.push(event)} 26function eventLoadMiniCartPage(){let listProducts=document.getElementsByClassName("mini-cart-item");let products=[];let list=breadcrumb.value;if(listProducts){for(var i=0;i<listProducts.length;i++){var product=getProductDataById(listProducts[i].dataset.analyticProductId,);if(product){product.list=list;products.push(product)}}} 27let event={event:"eventoEC",eventCat:"ecommerce",eventAct:"checkout-1",eventLbl:"carrito",noInteraction:"true",ecommerce:{currencyCode:"EUR",checkout:{actionField:{step:1},products:products,},},};("eventLoadMiniCartPage",event);window.dataLayer.push(event)} 28function gtag_report_conversion_logout(url){var callback=function(){("gtag logout");if(typeof url!="undefined"){window.location=url}};gtag("event","conversion",{send_to:"AW-691985440/FMImCPrYzPkBEKC4-8kC",event_callback:callback,});return!1} 29function eventLogoutUser(){let event={event:"evento",eventCat:"privateArea",eventAct:"logout",eventLbl:"ok",userId:user.userId,lastLogin:user.lastLogin,firstLogin:user.firstLogin,lastPurchase:user.lastPurchase,};if(document.documentElement.lang!=="pt-PT"){if(typeof fbq!=="undefined"){fbq("track","SubmitApplication")}}("eventLogoutUser",event);window.dataLayer.push(event);gtag_report_conversion_logout()} 30function eventLogintUser(user){let event={event:"evento",eventCat:"privateArea",eventAct:"login",eventLbl:"ok",userId:user.userId,lastLogin:user.lastLogin,firstLogin:user.firstLogin,lastPurchase:user.lastPurchase,};("eventLogintUser",event);window.dataLayer.push(event)} 31function gtag_report_conversion_register(url){("event","gtag_report_conversion");var callback=function(){if(typeof url!="undefined"){window.location=url}};gtag("event","conversion",{send_to:"AW-691985440/E-kSCJCe4_kBEKC4-8kC",event_callback:callback,});return!1} 32function loopProductSheet(){let productSheet=document.getElementsByClassName("ficha-producto");if(productSheet&&productSheet.length>0){let clickProduct=function(event){if(this.dataset.analyticProductId){let position=1;if(this.parentElement.parentElement.dataset.slickIndex){position=parseInt(this.parentElement.parentElement.dataset.slickIndex)+1}else if(this.dataset.slickIndex){position=this.dataset.slickIndex} 33eventClickProduct(getProductDataById(this.dataset.analyticProductId),position,)}};for(let i=0;i<productSheet.length;i++){productSheet[i].addEventListener("click",clickProduct,!1)}}} 34function loopUserLogout(){let logoutClick=document.getElementsByClassName("woocommerce-MyAccount-navigation-link--customer-logout",);if(logoutClick&&logoutClick.length>0){let addLogoutClick=function(event){eventLogoutUser()};for(var i=0;i<logoutClick.length;i++){logoutClick[i].addEventListener("click",addLogoutClick,!1)}}} 35function loopOpenCart(){var clickShowMiniCart=document.getElementsByClassName("desplegable-desplegar",);if(clickShowMiniCart&&clickShowMiniCart.length>0){let clickMiniCart=function(event){eventLoadMiniCartPage()};for(var i=0;i<clickShowMiniCart.length;i++){if(clickShowMiniCart[i].dataset.obj==="#mini-cart"){clickShowMiniCart[i].addEventListener("click",clickMiniCart,!1)}}}} 36jQuery(document).ready(function(){if(page.name==="home"){eventLoadHome()} 37if(document.body.classList.contains("single-product")||page.name==="product"){eventLoadProductPage()} 38if(page.name==="checkout"){eventLoadCheckoutPage()} 39if(window.location.search.substr(1)==="new-register"&&page.name==="my-account"){} 40loopProductSheet();loopUserLogout();loopOpenCart();var $orderElement=jQuery(".woocommerce-ordering select");if($orderElement.length){var stringToAnalyticsOrder={popularity:"popularidad",date:"útlimos",price:"precio bajo a precio alto","price-desc":"precio alto a precio bajo",};$orderElement.on("change",function(){var valueOrder=jQuery(this).val();if(valueOrder&&stringToAnalyticsOrder.hasOwnProperty(valueOrder)){var eventOrder={event:"evento",eventCat:"filtro",eventAct:"ordenar",eventLbl:stringToAnalyticsOrder[valueOrder],};("eventOrder",eventOrder);window.dataLayer.push(eventOrder)}})} 41jQuery(document).on("facetwp-loaded",function(){let config={price:!1,order:!1,search:!1,categories:[],};let categories=[];if(FWP.facets.categora_hidrolimpiadoras){FWP.facets.categora_hidrolimpiadoras.forEach((element)=>categories.push(element),)} 42if(FWP.facets.categora_soplanieves){FWP.facets.categora_soplanieves.forEac
42h((element)=>categories.push(element),)} 43if(FWP.facets.categoria_aceites_y_gasolinas){FWP.facets.categoria_aceites_y_gasolinas.forEach((element)=>categories.push(element),)} 44if(FWP.facets.categoria_automower){FWP.facets.categoria_automower.forEach((element)=>categories.push(element),)} 45if(FWP.facets.categoria_aspiradoras){FWP.facets.categoria_aspiradoras.forEach((element)=>categories.push(element),)} 46if(FWP.facets.categoria_cortacespedes){FWP.facets.categoria_cortacespedes.forEach((element)=>categories.push(element),)} 47if(FWP.facets.categoria_cortasetos){FWP.facets.categoria_cortasetos.forEach((element)=>categories.push(element),)} 48if(FWP.facets.categoria_desbrozadoras){FWP.facets.categoria_desbrozadoras.forEach((element)=>categories.push(element),)} 49if(FWP.facets.categoria_escarificadores_cesped){FWP.facets.categoria_escarificadores_cesped.forEach((element)=>categories.push(element),)} 50if(FWP.facets.categoria_herramientas_forestales){FWP.facets.categoria_herramientas_forestales.forEach((element)=>categories.push(element),)} 51if(FWP.facets.categoria_juguetes){FWP.facets.categoria_juguetes.forEach((element)=>categories.push(element),)} 52if(FWP.facets.categoria_merchandising){FWP.facets.categoria_merchandising.forEach((element)=>categories.push(element),)} 53if(FWP.facets.categoria_motoazada){FWP.facets.categoria_motoazada.forEach((element)=>categories.push(element),)} 54if(FWP.facets.categoria_motosierras){FWP.facets.categoria_motosierras.forEach((element)=>categories.push(element),)} 55if(FWP.facets.categoria_ropa){FWP.facets.categoria_ropa.forEach((element)=>categories.push(element))} 56if(FWP.facets.categoria_sopladores){FWP.facets.categoria_sopladores.forEac
56h((element)=>categories.push(element),)} 57config.categories=categories;if(FWP.facets.price_range.length>0){config.price=FWP.facets.price_range} 58if(FWP.facets.buscador_productos!==""){config.search=FWP.facets.buscador_productos} 59if(FWP_HTTP.get.orderby){config.order=FWP_HTTP.get.orderby} 60eventLoadCategoryPage(config)});jQuery(document).on("facetwp-refresh",function(){let config={price:!1,order:!1,search:!1,categories:[],};let categories=[];if(FWP.facets.categora_hidrolimpiadoras){FWP.facets.categora_hidrolimpiadoras.forEach((element)=>categories.push(element),)} 61if(FWP.facets.categora_soplanieves){FWP.facets.categora_soplanieves.forEach((element)=>categories.push(element),)} 62if(FWP.facets.categoria_aceites_y_gasolinas){FWP.facets.categoria_aceites_y_gasolinas.forEach((element)=>categories.push(element),)} 63if(FWP.facets.categoria_automower){FWP.facets.categoria_automower.forEach((element)=>categories.push(element),)} 64if(FWP.facets.categoria_aspiradoras){FWP.facets.categoria_aspiradoras.forEach((element)=>categories.push(element),)} 65if(FWP.facets.categoria_cortacespedes){FWP.facets.categoria_cortacespedes.forEach((element)=>categories.push(element),)} 66if(FWP.facets.categoria_cortasetos){FWP.facets.categoria_cortasetos.forEach((element)=>categories.push(element),)} 67if(FWP.facets.categoria_desbrozadoras){FWP.facets.categoria_desbrozadoras.forEach((element)=>categories.push(element),)} 68if(FWP.facets.categoria_escarificadores_cesped){FWP.facets.categoria_escarificadores_cesped.forEach((element)=>categories.push(element),)} 69if(FWP.facets.categoria_herramientas_forestales){FWP.facets.categoria_herramientas_forestales.forEach((element)=>categories.push(element),)} 70if(FWP.facets.categoria_juguetes){FWP.facets.categoria_juguetes.forEach((element)=>categories.push(element),)} 71if(FWP.facets.categoria_merchandising){FWP.facets.categoria_merchandising.forEach((element)=>categories.push(element),)} 72if(FWP.facets.categoria_motoazada){FWP.facets.categoria_motoazada.forEach((element)=>categories.push(element),)} 73if(FWP.facets.categoria_motosierras){FWP.facets.categoria_motosierras.forEach((element)=>categories.push(element),)} 74if(FWP.facets.categoria_ropa){FWP.facets.categoria_ropa.forEach((element)=>categories.push(element))} 75if(FWP.facets.categoria_sopladores){FWP.facets.categoria_sopladores.forEac
75h((element)=>categories.push(element),)} 76config.categories=categories;if(FWP.facets.price_range.length>0){config.price=FWP.facets.price_range;let min_price=0;let max_price=0;if(config.price.length>0){for(let i=0;i<config.price.length;i++){if(i===0){min_price=parseInt(config.price[0])} 77if(i===1){max_price=parseInt(config.price[1])}}} 78let eventPrice={event:"evento",eventCat:"filtro",eventAct:"precio",eventLbl:min_price+" - "+max_price,};("eventPrice",eventPrice);window.dataLayer.push(eventPrice)} 79if(FWP.facets.buscador_productos!==""){} 80if(FWP_HTTP.get.orderby){} 81if(FWP.facets.superficie_jardn&&FWP.facets.superficie_jardn!==""&&FWP.facets.superficie_jardn.length>0){let eventSuperf={event:"evento",eventCat:"filtro",eventAct:"superficie",eventLbl:FWP.facets.superficie_jardn.join(" - "),};("eventSuperf",eventSuperf);window.dataLayer.push(eventSuperf)} 82if(categories.length>0){let eventCategories={event:"evento",eventCat:"filtro",eventAct:"subcategorias",eventLbl:categories.join(" - "),};("eventCategories",eventCategories);window.dataLayer.push(eventCategories)}});var classPaymentMethod=".wc_payment_method";var $inputPaymentMethod=jQuery(classPaymentMethod);if($inputPaymentMethod.length){var $childsMethods;var paymentMethodUpdate=function(){var $inputs=jQuery('input[name="payment_method"]',$inputPaymentMethod);var $selectedElement=jQuery('input:radio[name="payment_method"]:checked',);var financingType;var selectedIndex=1;for(var i=0;i<$inputs.length;i++){if($inputs[i].id===$selectedElement.attr("id")){selectedIndex=i+1}} 83var $childsSelected=$selectedElement.parent().find("fieldset input:checked");if($childsSelected.length){if(!$childsMethods){$childsMethods=$selectedElement.parent().find("fieldset input");$childsMethods.on("change",function(){paymentMethodUpdate()})} 84financingType=$childsSelected.next().text()} 85var event={event:"eventoEC",eventCat:"ecommerce",eventAct:"checkout-2",eventLbl:"paymentType",noInteraction:!0,ecommerce:{checkout_option:{actionField:{step:selectedIndex,option:$selectedElement.val(),financingType:financingType,},},},};("eventPaymentMethod",event);window.dataLayer.push(event)};jQuery("body").on("payment_method_selected",function(){paymentMethodUpdate()})} 86if(page.name==="product"&&typeof product!=="undefined"){jQuery(document).on("click",".btn-ver-mas",function(){const isExpanded=jQuery(this).data("expanded");jQuery(this).data("expanded",!isExpanded);if(!isExpanded){window.dataLayer.push({event:"pdp_expand_content",page_type:"pdp",item_id:product.sku,item_name:product.name,item_category:product.category,content_section:"description",})}})} 87if(page.name==="product"&&typeof product!=="undefined"){jQuery(document).on("click",".accordion-button[data-bs-target='#collapseEspecificaciones']",function(){const isCollapsed=jQuery(this).hasClass("collapsed");if(!isCollapsed){window.dataLayer.push({event:"pdp_specs_open",page_type:"pdp",item_id:product.sku,item_name:product.name,item_category:product.category,})}},)} 88if(page.name==="product"&&typeof product!=="undefined"){jQuery(document).on("click",".boton-producto .btn-cart",function(){window.dataLayer.push({event:"pdp_tech_sheet_download",page_type:"pdp",item_id:product.sku,item_name:product.name,item_category:product.category,file_url:jQuery(this).attr("href"),})})} 89if(page.name==="product"&&typeof product!=="undefined"){const apzDiv=document.querySelector("[data-aplazame-widget-instalments]");if(apzDiv){let apzEventFired=!1;apzDiv.addEventListener("click",function(){if(!apzEventFired){apzEventFired=!0;window.dataLayer.push({event:"pdp_financing_interaction",page_type:"pdp",item_id:product.sku,item_name:product.name,item_category:product.category,financing_action:"open",})}})}} 90const form=document.getElementById("gform_1");if(form){form.addEventListener("submit",gtag_report_conversion_newsletter);if(form.closest(".single-product")&&page.name==="product"&&typeof product!=="undefined"){let newsletterEventFired=!1;form.addEventListener("submit",function(){if(!newsletterEventFired){newsletterEventFired=!0;window.dataLayer.push({event:"pdp_newsletter_subscribe",page_type:"pdp",item_id:product.
90sku,item_name:product.name,item_category:product.category,newsletter_location:"pdp",})}})}} 91if(page.name==="product"&&typeof product!=="undefined"){const trustTypeMap={envio:"shipping",garantia:"warranty",devolucion:"returns",financiacion:"financing",};jQuery(document).on("click",".item-conditions",function(){const condition=jQuery(this).data("condition");const trustType=trustTypeMap[condition];if(!trustType)return;window.dataLayer.push({event:"pdp_trust_info_open",trust_type:trustType,item_id:product.sku,item_name:product.name,item_category:product.category,page_type:"pdp",content_section:"trust_info",})})} 92if(page.name==="checkout"){let lastCouponEntered=null;let lastCouponFailKey=null;let lastErrorSetKey=null;function classifyErrorGroup(messages){const joined=messages.join(" ").toLowerCase();if(/cartão|pagamento|payment|card|cvv|validade|expirac/.test(joined)) 93return"payment";if(/envio|envÃo|shipping|postal|postcode|destino|entrega/.test(joined)) 94return"shipping";if(/obrigatório|obrigatorio|requerido|preencha|campo|email|telefone|nome|apelido/.test(joined,)) 95return"validation";if(/termos|condições|polÃtica|legal/.test(joined))return"legal";return"technical"} 96function pushCheckoutError(){const errorItems=jQuery(".woocommerce-error li");if(!errorItems.length)return;const messages=[];errorItems.each(function(){const msg=jQuery(this).text().trim();if(msg)messages.push(msg)});if(!messages.length)return;const errorSetKey=messages.join("|");if(errorSetKey===lastErrorSetKey)return;lastErrorSetKey=errorSetKey;window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:"checkout_error",page_type:"checkout",checkout_step:"checkout",errors_count:messages.length,error_message_primary:messages[0],error_messages_joined:messages.join(" | "),error_group:classifyErrorGroup(messages),})} 97jQuery(document).on("click","#place_order",function(){lastErrorSetKey=null});jQuery(document.body).on("checkout_error",function(){pushCheckoutError()});const noticesWrapper=document.querySelector(".woocommerce-notices-wrapper",);if(noticesWrapper){const errorsObserver=new MutationObserver(function(){if(jQuery(".woocommerce-error li").length){pushCheckoutError()}});errorsObserver.observe(noticesWrapper,{childList:!0,subtree:!0,})} 98jQuery(document).on("click",'button[name="apply_coupon"]',function(){const couponInput=jQuery("#coupon_code").val();if(!couponInput||!couponInput.trim())return;lastCouponEntered=couponInput.trim().toUpperCase();window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:"checkout_coupon_apply",page_type:"checkout",checkout_step:"review",coupon_entered:lastCouponEntered,});const couponForm=document.querySelector(".checkout_coupon");if(!couponForm)return;const couponObserver=new MutationObserver(function(mutations,obs){const errorEl=couponForm.querySelector("#coupon-error-notice");if(!errorEl)return;const msg=errorEl.textContent.replace("X","").trim();if(!msg)return;obs.disconnect();const failKey=lastCouponEntered+"|"+msg;if(failKey!==lastCouponFailKey){lastCouponFailKey=failKey;window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:"checkout_coupon_fail",page_type:"checkout",checkout_step:"review",coupon_entered:lastCouponEntered,fail_reason:"invalid_coupon",error_message:msg,})}});couponObserver.observe(couponForm,{childList:!0,subtree:!0,characterData:!0,})})}});(function(){"use strict";function normalizeLabel(str){if(!str)return null;return str.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s_-]/g,"").replace(/\s+/g,"_")} 99function inferLinkType(url){if(!url||url==="#"||url==="javascript:void(0)")return null;try{var path=new URL(url,window.location.origin).pathname;if(/\/(catalogo|folleto)(cat)?(\/|$)/.test(path))return"catalog";if(/\/contacto(\/|$)/.test(path))return"page";return"category"}catch(e){} 100return null} 101function pushMenuEvent(params){window.dataLayer=window.dataLayer||[];window.dataLayer.push({event:"menu_navigation_click",menu_location:params.menu_location,menu_level:params.menu_level,menu_item:params.menu_item,menu_parent:params.menu_parent||null,menu_grandparent:params.menu_grandparent||null,menu_url:params.menu_url||null,link_type:params.link_type||null,page_path:window.location.pathname,})} 102function getParentItemLabel(el){if(!el)return null;var span=el.querySelector("span.ms-16");return normalizeLabel(span?span.textContent:el.textContent)} 103document.addEventListener("DOMContentLoaded",function(){var staticNav=document.querySelector(".navbar-static-links");if(staticNav){staticNav.addEventListener("click",function(e){var link=e.target.closest(".
103navbar-static-link");if(!link)return;if(e.target.closest(".dropdown-menu"))return;var href=link.getAttribute("href");var url=!href||href==="#"||href==="javascript:void(0)"?null:href;pushMenuEvent({menu_location:"main_menu",menu_level:"level_1",menu_item:normalizeLabel(link.textContent),menu_url:url,link_type:url?inferLinkType(url):null,})});staticNav.addEventListener("click",function(e){var link=e.target.closest(".dropdown-custom-link");if(!link)return;var dropdownMenu=link.closest(".dropdown-menu");var parentLi=dropdownMenu?dropdownMenu.closest(".nav-item"):null;var parentToggle=parentLi?parentLi.querySelector(":scope > a.navbar-static-link"):null;var url=link.getAttribute("href");pushMenuEvent({menu_location:"main_menu",menu_level:"level_2",menu_item:normalizeLabel(link.querySelector("span.ms-16")?link.querySelector("span.ms-16").textContent:link.textContent,),menu_parent:parentToggle?normalizeLabel(parentToggle.textContent):null,menu_url:url,link_type:inferLinkType(url),})})} 104var megamenu=document.getElementById("offcanvasMegaMenu");if(megamenu){megamenu.addEventListener("click",function(e){var activeLevel2=megamenu.querySelector(".megamenu-parent-item.is-active",);var activeLevel2Label=getParentItemLabel(activeLevel2);var childLink=e.target.closest(".megamenu-child-item a");if(childLink){var url=childLink.getAttribute("href");pushMenuEvent({menu_location:"main_menu",menu_level:"level_3",menu_item:normalizeLabel(childLink.querySelector("span.ms-16")?childLink.querySelector("span.ms-16").textContent:childLink.textContent,),menu_parent:activeLevel2Label,menu_grandparent:"produtos",menu_url:url,link_type:inferLinkType(url),});return} 105var popularLink=e.target.closest(".megamenu-popular-block a");if(popularLink){var url=popularLink.getAttribute("href");pushMenuEvent({menu_location:"main_menu",menu_level:"level_3",menu_item:normalizeLabel(popularLink.textContent),menu_parent:activeLevel2Label,menu_grandparent:"produtos",menu_url:url,link_type:inferLinkType(url),});return} 106var parentItem=e.target.closest(".megamenu-parent-item");if(parentItem){var url=parentItem.dataset.url||null;pushMenuEvent({menu_location:"main_menu",menu_level:"level_2",menu_item:getParentItemLabel(parentItem),menu_parent:"produtos",menu_url:url,link_type:url?inferLinkType(url):null,});return}})} 107var mobileMenu=document.getElementById("offcanvasMobileMenu");if(mobileMenu){mobileMenu.addEventListener("click",function(e){var popularLink=e.target.closest(".mobile-popular-block a");if(popularLink){var backLabel=mobileMenu.querySelector("#mobileBackLabel");var url=popularLink.getAttribute("href");pushMenuEvent({menu_location:"mobile_menu",menu_level:"level_3",menu_item:normalizeLabel(popularLink.textContent),menu_parent:backLabel?normalizeLabel(backLabel.textContent):null,menu_grandparent:"produtos",menu_url:url,link_type:inferLinkType(url),});return} 108var subcatLink=e.target.closest(".mobile-subcats-list a");if(subcatLink){var backLabel=mobileMenu.querySelector("#mobileBackLabel");var url=subcatLink.getAttribute("href");pushMenuEvent({menu_location:"mobile_menu",menu_level:"level_3",menu_item:normalizeLabel(subcatLink.querySelector("span.ms-16")?subcatLink.querySelector("span.ms-16").textContent:subcatLink.textContent,),menu_parent:backLabel?normalizeLabel(backLabel.textContent):null,menu_grandparent:"produtos",menu_url:url,link_type:inferLinkType(url),});return} 109var wpPanelLink=e.target.closest(".mobile-panel-item a");if(wpPanelLink){var activeTab=mobileMenu.querySelector(".mobile-menu-tab.is-active",);var url=wpPanelLink.getAttribute("href");pushMenuEvent({menu_location:"mobile_menu",menu_level:"level_2",menu_item:normalizeLabel(wpPanelLink.querySelector("span.ms-16")?wpPanelLink.querySelector("span.ms-16").textContent:wpPanelLink.textContent,),menu_parent:activeTab?normalizeLabel(activeTab.textContent):null,menu_url:url,link_type:inferLinkType(url),});return} 110var catItem=e.target.closest(".mobile-panel-item--cat");if(catItem){var url=catItem.dataset.url||null;pushMenuEvent({menu_location:"mobile_menu",menu_level:"level_2",menu_item:normalizeLabel(catItem.querySelector("span.ms-16")?catItem.querySelector("span.ms-16").textContent:catItem.textContent,),menu_parent:"produtos",menu_url:url,link_type:url?inferLinkType(url):null,});return} 111var tab=e.target.closest(".mobile-menu-tab");if(tab){pushMenuEvent({menu_location:"mobile_menu",menu_level:"level_1",menu_item:normalizeLabel(tab.textContent),menu_url:null,link_type:null,});return}})}})})();document.addEventListener("click",function(e){const btn=e.target.closest(".single_add_to_cart_button, .boton-add-cart-ficha");if(!btn)return;if(typeof product!=="undefined"&&product.id&&product.name){const quantity=document.querySelector('input[name="quantity"]')?.value||1;eventClickAddCart(product,1,parseInt(quantity));return} 112const productId=btn.dataset.product_id;if(!productId)return;
112const productContainer=document.querySelector('[data-analytic-product-id="'+productId+'"]');if(productContainer){const productData=getProductDataById(productId,"analytic-product");if(productData&&productData.id&&productData.name){productData.price=parseFloat(productData.price)||0;eventClickAddCart(productData,productData.position||1,parseInt(btn.dataset.quantity||1))}}},!0)
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.