Authored by hongweigao

为您推荐埋点

... ... @@ -1481,7 +1481,8 @@ const recommendAsync = (skn, page, limit) => {
price: formatPrice(helpers.round(salePrice, 2)),
product_name: rp.product_name,
url: productUrl(rp.product_id, defaultGoods.goods_id, rp.cn_alphabet),
pic_url: productImageUrl(rp)
pic_url: productImageUrl(rp),
goods_id: defaultGoods.goods_id
};
});
... ...
{{# products}}
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
... ...
... ... @@ -93,6 +93,20 @@ bindEvent.add(function() {
var $couponItem = $('.coupon-item');
function randomString(len) {
var $chars = 'ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-';
var maxPos = $chars.length,
pwd = '',
i;
for (i = 0; i < len; i++) {
pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
}
return pwd;
}
function openCouponDialog(e) {
var $coupons = $couponItem.map(function(i) {
var $this = $(this);
... ... @@ -1150,3 +1164,46 @@ bindEvent.fire();
// 数据懒加载
dataLazyLoad.init({cls: '.datalazyload', threshold: 0});
/*
* 页面加载完
*/
$(function() {
var $goodsIdArr = [],
loadYas = {};
$('.recommend-slider .img-item .goods-id').each(function() {
$goodsIdArr.push($(this).html());
});
loadYas = {
REC_POSE: 100013,
REC_ID: randomString(40),
PRD_ID: $goodsIdArr.join(','),
PRD_NUM: $goodsIdArr.length,
ACTION_ID: 0,
PAGE_NUM: 1
};
// 关键词搜索结果页展示时
yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas);
});
// 点击为您推荐商品埋点
$('.recommend-slider .img-item').click(function() {
var $this = $(this);
var loadYas = {
REC_POSE: 100013,
REC_ID: randomString(40),
PRD_ID: $this.find('.goods-id').html(),
PRD_NUM: $this.index(),
ACTION_ID: 1,
PAGE_NUM: 1
};
// 关键词搜索结果页展示时
yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas);
});
... ...