Authored by zhangxiaoru

为你优选埋点

... ... @@ -140,6 +140,7 @@ exports.preference = (req, res, next) => {
productskn: req.query.productSkn,
limit: '20' // 后期值需要修改的话得手动改
}).then((result) => {
console.log(result, 123)
res.send(result);
}).catch(next);
};
... ...
... ... @@ -16,15 +16,15 @@ module.exports = {
siteUrl: '//m.yohobuy.com',
assetUrl: '//localhost:5001',
domains: {
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test3.yohops.com:9999/'
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/'
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
liveApi: 'http://api.live.yoho.cn/',
singleApi: 'http://single.yoho.cn/'
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/'
},
subDomains: {
host: '.m.yohobuy.com',
... ...
... ... @@ -6,7 +6,8 @@
var lazyLoad = require('yoho-jquery-lazyload'),
$ = require('yoho-jquery');
$ = require('yoho-jquery'),
uuid = require('uuid');
var $recommendForYou = $('.recommend-for-you'),
preferenceUrl = $('#preferenceUrl').val(),
... ... @@ -14,6 +15,39 @@ var $recommendForYou = $('.recommend-for-you'),
end = false,
requesting = false;
var getChannel, C_ID, uuidVal, goodid, goodIds = [], prdLoad;
getChannel = function functionName() {
var name = window.cookie('_Channel');
return {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
}[name] || 1;
};
C_ID = getChannel();
uuidVal = uuid.v4() + '0000';
function yasRequest(PRD_ID, PRD_NUM, ACTION_ID) {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_CHOOSE_FOR_YOU_Y',
param: JSON.stringify({
REC_POSE: 100013,
REC_ID: uuidVal,
PRD_ID: PRD_ID,
PRD_NUM: PRD_NUM,
C_ID: C_ID,
ACTION_ID: ACTION_ID,
PAGE_NUM: 1
})
}, true);
}
}
function request() {
if (requesting || end) {
... ... @@ -26,6 +60,31 @@ function request() {
$.get(preferenceUrl).then(function(html) {
$recommendForYou.html(html).show();
lazyLoad($recommendForYou.find('img.lazy'));
//为你优选埋点- 加载
$('.goods-container').find('.good-info').each(function() {
goodid = $(this).data('good-id');
if (goodid) {
goodIds.push(goodid);
}
})
prdLoad = JSON.stringify(goodIds).replace(/\[|\]|/g, '');
yasRequest(prdLoad, goodIds.length, 0);
//点击商品
$('.good-info').on('click', function() {
var PRD_ID = $(this).data('good-id'),
PRD_NUM = $(this).index();
yasRequest(PRD_ID, PRD_NUM, 1);
//return false;
});
}).fail(function() {
$recommendForYou.hide();
});
... ... @@ -41,3 +100,5 @@ function scrollHandler() {
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
... ...