Authored by hongweigao

加载完推荐列表,在家埋点

... ... @@ -93,20 +93,6 @@ 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);
... ... @@ -1037,6 +1023,46 @@ $('.comments').on('click', '.img-preview [data-role="preview-right"]', function(
$img.css('transform', 'rotate(' + rotate + 'deg)');
});
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 initPageYas() {
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,
ORDER_CODE: '',
ACTION_ID: 0,
PAGE_NUM: 1
};
// 关键词搜索结果页展示时
yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas);
};
// 店铺推荐
function loadRecommend() {
$.ajax({
... ... @@ -1071,6 +1097,27 @@ function loadRecommend() {
$('.individual-comment').find('.block-title').find('.title').addClass('cur').prev('.sep').addClass('hide');
$('#recommend-shop').detach();
}
//页面加载完,埋点
initPageYas();
// 点击为您推荐商品埋点
$('.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: parseInt($this.index(), 10) + 1,
ORDER_CODE: '',
ACTION_ID: 1,
PAGE_NUM: 1
};
// 关键词搜索结果页展示时
yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas);
});
});
}
... ... @@ -1165,45 +1212,3 @@ 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);
});
... ...