local na rede Internet:Home - Eternal Wigs - Wigs Shop para Mulherescontente
(function(){classUltimate_Shopify_DataLayer{constructor(){window.dataLayer=window.dataLayer||[];//useaprefixofeventsnamethis.eventPrefix='tuhin_';//Keepthevaluefalsetogetnon-formattedproductIDthis.formattedItemId=true;//dataschemathis.dataSchema={ecommerce:{show:true},dynamicRemarketing:{show:true,business_vertical:'retail'}}//addtowishlistselectorHome - Eternal Wigs - Wigs Shop para Mulheressthis.addToWishListSelectors={'addWishListIcon':'','gridItemSelector':'','productLinkSelector':'a[href*="/products/Home - Eternal Wigs - Wigs Shop para Mulheres"]'}//quickviewselectorsthis.quickViewSelector={'quickViewElement':'','gridItemSelector':'','productLinkSelector':'a[href*="/products/"]'}//minicartbuttonselectorthis.miniCartButton=['a[href="/cart"]',];this.miniCartAppersOn='click';//begincheckoutbuttons/linksselectorsthis.beginCheckoutButtons=['input[name="checkout"]','button[name="checkout"]','a[href="/checkout"]','.additional-checkout-buttons',];//directcheckoutbuttonselectorthis.shopifyDirectCheckoutButton=['.shopify-payment-button']//KeepthevaluetrueifAddtoCartredirectstothecartpethis.isAddToCartRedirect=false;//keepthevaluefalseifcartitemsincrement/decrement/removerefreshpethis.isAjaxCartIncrementDecrement=true;//Caution:Donotmodifyanythingbelowthisline,asitmayresultinitnotfunctioningcorrectly.this.cart={"note":null,"attributes":{},"original_total_price":0,"total_price":0,"total_discount":0,"total_weight":0.0,"item_count":0,"items":[],"requires_shipping":false,"currency":"GBP","items_subtotal_price":0,"cart_level_discount_applications":[],"checkout_charge_amount":0}this.countryCode="GB";this.storeURL="eternalwigs.com";localStore.setItem('shopCountryCode',this.countryCode);this.collectData();this.itemsList=[];}updateCart(){fetch("/cart.js").then((response)=>response.json()).then((data)=>{this.cart=data;});}debounce(delay){lettimeoutId;returnfunction(func){constcontext=this;constargs=arguments;clearTimeout(timeoutId);timeoutId=setTimeout(function(){func.apply(context,args);},delay);};}eventConsole(eventName,eventData){constcss1='background:red;color:#fff;font-size:normal;border-radius:3px003px;padding:3px4px;';constcss2='background-color:blue;color:#fff;font-size:normal;border-radius:03px3px0;padding:3px4px;';console.log('%cGTMDataLayerEvent:%c'+eventName,css1,css2,eventData);}collectData(){this.customerData();this.ajaxRequestData();this.searchPeData();this.miniCartData();this.beginCheckoutData();this.addToWishListData();this.quickViewData();this.selectItemData();this.formData();this.phoneClickData();this.emailClickData();this.loginRegisterData();}//logged-incustomerdatacustomerData(){constcurrentUser={};if(currentUser.email){currentUser.hash_email="e3b0cfc1c149afbf4c8996fbae41e4649b934cab7852b855"}if(currentUser.phone){currentUser.hash_phone="e3b0cfc1c149afbf4c8996fbae41e4649b934cab7852b855"}window.dataLayer=window.dataLayer||[];dataLayer.push({customer:currentUser});}//add_to_cart,remove_from_cart,searchajaxRequestData(){constself=this;//handlenon-ajaxaddtocartif(this.isAddToCartRedirect){document.addEventListener('submit',function(event){constaddToCartForm=event.target.closest('form[action="/cart/add"]');if(addToCartForm){event.preventDefault();constformData=newFormData(addToCartForm);fetch(window.Shopify.routes.root+'cart/add.js',{method:'POST',body:formData}).then(response=>{window.location.href="/cart";}).catch((error)=>{console.error('Error:',error);});}});}//fetchletoriginalFetch=window.fetch;letdebounce=this.debounce(800);window.fetch=function(){returnoriginalFetch.apply(this,arguments).then((response)=>{if(response.ok){letcloneResponse=response.clone();letrequestURL=arguments[0]['url']||arguments[0];if(/.*\/search\/?.*\?.*q=.+/.test(requestURL)&&!requestURL.includes('&requestFrom=uldt')){constqueryString=requestURL.split('?')[1];consturlParams=newURLSearchParams(queryString);constsearch_term=urlParams.get("q");debounce(function(){fetch(`${self.storeURL}/search/suggest.json?q=${search_term}&resources[type]=product&requestFrom=uldt`).then(res=>res.json()).then(function(data){constproducts=data.resources.results.products;if(products.length){constfetchRequests=products.map(product=>fetch(`${self.storeURL}/${product.url.split('?')[0]}.js`).then(response=>response.json()).catch(error=>console.error('Errorfetching:',error)));Promise.all(fetchRequests).then(products=>{constitems=products.map((product)=>{return{product_id:product.id,product_title:product.title,variant_id:product.variants[0].id,variant_title:product.variants[0].title,vendor:product.vendor,total_discount:0,final_price:product.price_min,product_type:product.type,quantity:1}});self.ecommerceDataLayer('search',{search_term,items});})}else{self.ecommerceDataLayer('search',{search_termHome - Eternal Wigs - Wigs Shop para Mulheres,items:[]});}});});}elseif(requestURL.includes("/cart/add")){cloneResponse.text().then((text)=>{letdata=JSON.parse(text);if(data.items&&Array.isArray(data.items)){data.items.forEach(function(item){self.ecommerceDataLayer('add_to_cart',{items:[item]});})}else{self.ecommerceDataLayer('add_to_cart',{items:[data]});}self.updateCart();});}elseif(requestURL.includes("/cart/change")||requestURL.includes("/cart/update")){cloneResponse.text().then((text)=>{letnewCart=JSON.parse(text);letnewCartItems=newCart.items;letoldCartItems=self.cart.items;for(leti=0;inewItems.id===item.id);if(newItem){if(newItem.quantity>item.quantity){//cartitemincrementletquantity=(newItem.quantity-item.quantity);letupdatedItem={...item,quantity}self.ecommerceDataLayer('add_to_cart',{items:[updatedItem]});self.updateCart();}elseif(newItem.quantity