!function(t,e,n,i){function o(n){var i="CN"===e[0].countryCode;t.ga.data.push(n),i&&n.hasOwnProperty("eventCallback")&&n.eventCallback()}t.ga=t.ga||{},t.ga.data=t.ga.data||{},t.ga.prod=t.ga.prod||{},t.ga.promo=t.ga.promo||{},t.ga.action=t.ga.action||{};var a=function(t,e,n,i,o,a,r,c,p,s){this.id=t,this.name=e,this.brand=n,this.category=i,this.variant=o,this.price=a,this.quantity=r,this.coupon=c,this.position=p,this.list=s},r=function(t,e,n,i,o,a,r,c){this.id=t,this.name=e,this.list=n,this.brand=i,this.category=o,this.variant=a,this.position=r,this.price=c},c=function(t,e,n,i,o,a,r,c,p){this.id=t,this.affiliation=e,this.revenue=n,this.tax=i,this.shipping=o,this.coupon=a,this.list=r,this.step=c,this.option=p},p="USD";t.ga.data.push=function(t){e.push(t)};var s=[],d=[],m=function(t){return t.replace(/([^0-9\.]*)/g,"")};t.ga.prod.setCurrency=function(t){p=t},t.ga.prod.addImp=function(t,e,n,i,o,a,c,p){t&&e&&s.push(new r(t,e,n,i,o,a,c,m(p)))},t.ga.prod.addToCart=function(t){if(t.find("[itemprop=sku]")){var e=t.find("[itemprop=sku]").attr("content")?t.find("[itemprop=sku]").attr("content"):t.find("[itemprop=sku]").text(),n=t.find("[itemprop=name]").attr("content")?t.find("[itemprop=name]").attr("content"):t.find("[itemprop=name]").text(),i=t.find("[itemprop=brand]").attr("content")?t.find("[itemprop=brand]").attr("content"):t.find("[itemprop=brand]").find("[itemprop=name]").text(),r=$("[itemprop=category]").attr("content"),c=m(t.find("[itemprop=offers]").find("[itemprop=price]").text()),s=t.find("[name=qty]").val();o({ecommerce:{currencyCode:p,click:new a(e,n,i,r,null,c,s,null,null,null)},pName:n,pCat:r,pID:e,pPrice:c,event:"addToCart"})}},t.ga.prod.detail=function(t,e,n,i,r,c,s,d,u,l){o({ecommerce:{currencyCode:p,detail:{actionField:{list:l},products:[new a(t,e,n,i,r,m(c),s,d,u,l)]}},pName:e,pCat:i,pID:t,pPrice:m(c),event:"detail"})},t.ga.prod.prodClick=function(t,e,n,i,a,r,s,d,u,l){o({ecommerce:{currencyCode:p,action:new c(t,e,n,i,a,m(r),s,d,u,l)},event:"prodClick"})},t.ga.prod.cart=function(t,e,n,i,o,r,c,p){d.push(new a(t,e,n,i,o,m(r),c,p,null,null))},t.ga.prod.pushImp=function(){var t={ecommerce:{currencyCode:p,impressions:s},event:"pushImp"};s=[],o(t)},t.ga.action.checkout=function(t,e){o({event:"checkout",ecommerce:{checkout:{actionField:{step:t,option:e}}}})},t.ga.action.changeDropdown=function(t){t=t||window.event;var e=$(t.target);o({event:"changeDropdown",category:e.data("ga-event-category"),action:e.data("ga-event-action"),label:e.data("ga-event-label")?e.data("ga-event-label"):e.find(":selected").data("ga-event-label"),value:e.data("ga-event-value")})},t.ga.action.purchase=function(t,e,n,i,a,r,s){var u=new c(t,e,m(n),m(i),m(a),r);u.dimension4=s;var l={ecommerce:{currencyCode:p,purchase:{actionField:u,products:d}}};o(l),o(l={transactionTotal:m(n)})},t.ga.promo.pushImp=function(t,e,n,i){o({ecommerce:{promoView:{promotions:[{id:t,name:e,creative:n,position:i}]}},event:"pushImp"})},t.ga.promo.click=function(t){o({event:"promotionClick",ecommerce:{promoClick:{promotions:[{id:t.id,name:t.name,creative:t.creative,position:t.pos}]}},eventCallback:function(){document.location=t.destinationUrl}})},t.ga.storage={set:function(t,e,n){var i=sessionStorage;n&&i.getItem(t)&&(e=i.getItem(t)+","+e),i.setItem(t,e)},get:function(t){return sessionStorage.getItem(t)},clear:function(t){t?sessionStorage.removeItem(t):sessionStorage.clear()}}}(window.ih=window.ih||{},window.dataLayer,window._gapro);