ut_view'); checkButtons.length && this.sendData(checkButtons,{actionName:'view_cart'}); }, /** *@method load 订单详情与提交订单页面加载完毕发送GA */ load:function(options){ var path = window.location.pathname; if(/settlement|order-details?|products/.test(path)) { this.handler(); //是否为商品详情页 if(path.indexOf('products') == -1) { //是否存在价格数据,存在则匹配出价格 if(options && typeof options.value == 'string'){ options.value = parseInt(options.value.match(/[.,\d]+$/)[0]); } if(options && /order-details?/.test(path)) { var trackOrders = window.Public.cookie.getItem("GTO-" + options.orderId),isTrack = true; trackOrders && trackOrders.indexOf("ga") != -1 || document.referrer == '' ? isTrack = false : window.Public.cookie.addItem("GTO-" + options.orderId,(trackOrders ? trackOrders +',' : '') + 'ga',{path:'/',endTime:60*60*24*30}); isTrack && gtag('event','purchase', {currency:options.currency,value:options.value,items: options.contents}); } else{ options && gtag('event','begin_checkout', {currency:options.currency,value:options.value,items: options.contents}); } } } }, handler:function(){ if(window.FBQ == undefined) { var self = this; window.FBQ = { load:window.TIKTOK || window.SNAPCHAT ? function(options){ window.TIKTOK && window.TIKTOK.load(options); window.SNAPCHAT && window.SNAPCHAT.load(options); self.load(options); } : this.load.bind(this) } } } } //ga初始化 GA.init();