diff --git a/static/js/common.js b/static/js/common.js index 4981f59..691fe94 100644 --- a/static/js/common.js +++ b/static/js/common.js @@ -158,6 +158,16 @@ function reMarginFooter(fixedElement) { $footer.removeClass('hide'); }()); +(function(w,d,s,j,f){ + w['YohoAcquisitionObject']=f; + w[f]=function(){w[f].p=arguments;}; + var a=d.createElement(s); + var m=d.getElementsByTagName(s)[0]; + a.async=1; + a.src=j; + m.parentNode.insertBefore(a,m); +})(window,document,'script','http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas-debug.js','_yas'); + (function() { var uid = getUid(); @@ -166,7 +176,7 @@ function reMarginFooter(fixedElement) { window._ozuid = uid;//暴露ozuid if (window._yas) { - window._yas(1 * new Date(), '1.0.13.2', 'yohobuy_m', uid, ''); + window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', uid, '', ''); } }()); diff --git a/static/js/product/detail/like.js b/static/js/product/detail/like.js index 5e1866f..782db59 100644 --- a/static/js/product/detail/like.js +++ b/static/js/product/detail/like.js @@ -30,6 +30,7 @@ if (likeHammer) { opt = 'ok'; favorite = 1; } + $.ajax({ type: 'POST', url: '/product/opt/favoriteProduct', @@ -51,19 +52,19 @@ if (likeHammer) { } else { tip.show(data.message); } - - // 统计代码:用于统计用户加入或取消商品收藏的动作 - if (window._yas) { - window._yas.sendCustomInfo({ - pd: productId, - fa: favorite - }); - } }, error: function() { tip.show('网络断开连接了~'); } }); + + // 统计代码:用于统计用户加入或取消商品收藏的动作 + if (window._yas) { + window._yas.sendCustomInfo({ + pd: productId, + fa: favorite + }, true); + } }); } @@ -75,7 +76,7 @@ if (addToCartHammer) { window._yas.sendCustomInfo({ pd: productId, by: 1 - }); + }, false); } }); } diff --git a/static/js/product/list.js b/static/js/product/list.js index 9e25518..18973c6 100644 --- a/static/js/product/list.js +++ b/static/js/product/list.js @@ -8,6 +8,7 @@ var $ = require('jquery'), Hammer = require('yoho.hammer'), lazyLoad = require('yoho.lazyload'); + //品牌页参数 var $brandHeader = $('#brand-header'), $introBox = $('#intro-box'); @@ -231,6 +232,25 @@ function search(opt) { loading.hideLoadingMask(); window.rePosFooter(); + + + // 用于统计点击了商品列表的第几个商品,序号从1开始计算。 + if (window._yas) { + switch (navType) { + case 'newest': + window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid, + '', '.new-goods .good-info .good-detail-img .good-thumb'); + break; + case 'price': + window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid, + '', '.new-goods .good-info .good-detail-img .good-thumb'); + break; + case 'discount': + window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid, + '', '.new-goods .good-info .good-detail-img .good-thumb'); + break; + } + } } }); @@ -455,8 +475,3 @@ $listNav.on('touchstart', 'li', function() { $listNav.find('li').removeClass('bytouch'); }); -// 用于统计点击了商品列表的第几个商品,序号从1开始计算。 -if (window._yas) { - window._yas(1 * new Date(), '1.0.13.2', 'yohobuy_m', window._ozuid, - '', '#goods-container >div >div .good-thumb >img'); -} \ No newline at end of file