Authored by 沈志敏

个性化推荐位埋点

@@ -195,7 +195,7 @@ module.exports = function(specificGender) { @@ -195,7 +195,7 @@ module.exports = function(specificGender) {
195 PRD_ID: PRDID.join(','), 195 PRD_ID: PRDID.join(','),
196 PRD_NUM: $(data).closest('.good-info').length, 196 PRD_NUM: $(data).closest('.good-info').length,
197 ACTION_ID: 0, 197 ACTION_ID: 0,
198 - page_num: RECPOSE === 110009 ? 1 : page 198 + PAGE_NUM: RECPOSE === 110009 ? 1 : page
199 }); 199 });
200 200
201 // 为您优选埋点 end 201 // 为您优选埋点 end
@@ -237,7 +237,7 @@ module.exports = function(specificGender) { @@ -237,7 +237,7 @@ module.exports = function(specificGender) {
237 PRD_ID: $(this).closest('.good-info').data('id'), 237 PRD_ID: $(this).closest('.good-info').data('id'),
238 PRD_NUM: index % pageNum === 0 ? pageNum : index % pageNum, 238 PRD_NUM: index % pageNum === 0 ? pageNum : index % pageNum,
239 ACTION_ID: 1, 239 ACTION_ID: 1,
240 - page_num: Math.ceil(index / pageNum) 240 + PAGE_NUM: Math.ceil(index / pageNum)
241 }); 241 });
242 return true; 242 return true;
243 }); 243 });
@@ -439,7 +439,7 @@ module.exports = function(specificGender) { @@ -439,7 +439,7 @@ module.exports = function(specificGender) {
439 // PRD_ID: PRDID.join(','), 439 // PRD_ID: PRDID.join(','),
440 // PRD_NUM: $(data).closest('.good-info').length, 440 // PRD_NUM: $(data).closest('.good-info').length,
441 // ACTION_ID: 0, 441 // ACTION_ID: 0,
442 -// page_num: page 442 +// PAGE_NUM: page
443 // }); 443 // });
444 444
445 // // 为您优选埋点 end 445 // // 为您优选埋点 end
@@ -484,7 +484,7 @@ module.exports = function(specificGender) { @@ -484,7 +484,7 @@ module.exports = function(specificGender) {
484 // PRD_ID: $(this).closest('.good-info').data('id'), 484 // PRD_ID: $(this).closest('.good-info').data('id'),
485 // PRD_NUM: index % pageNum === 0 ? pageNum : index % pageNum, 485 // PRD_NUM: index % pageNum === 0 ? pageNum : index % pageNum,
486 // ACTION_ID: 1, 486 // ACTION_ID: 1,
487 -// page_num: Math.ceil(index / pageNum) 487 +// PAGE_NUM: Math.ceil(index / pageNum)
488 // }); 488 // });
489 // return true; 489 // return true;
490 // }); 490 // });
@@ -317,31 +317,30 @@ function downLoadApp(unionType) { @@ -317,31 +317,30 @@ function downLoadApp(unionType) {
317 317
318 // 为您优选埋点 http://redmine.yoho.cn/issues/10117 318 // 为您优选埋点 http://redmine.yoho.cn/issues/10117
319 function givePoint(parameter) { 319 function givePoint(parameter) {
320 - var CID = 1;  
321 -  
322 if (!window._yas || !window._yas.sendCustomInfo) { 320 if (!window._yas || !window._yas.sendCustomInfo) {
323 return false; 321 return false;
324 } 322 }
325 323
  324 + if (!parameter.REC_POSE || !parameter.PRD_ID) {
  325 + return true;
  326 + }
  327 +
326 // 男:1,女:2,潮童:3,创意生活:4 328 // 男:1,女:2,潮童:3,创意生活:4
327 - CID = _ChannelVary[cookie('_Channel')] || 1; 329 + var CID = _ChannelVary[cookie('_Channel')] || 1;
  330 + var isAppOp = parameter.isAppOp;
328 331
329 parameter = $.extend({ 332 parameter = $.extend({
330 - REC_POSE: '',  
331 REC_ID: RECID, 333 REC_ID: RECID,
332 - PRD_ID: '',  
333 PRD_NUM: 0, 334 PRD_NUM: 0,
334 C_ID: CID, 335 C_ID: CID,
335 ACTION_ID: 0, 336 ACTION_ID: 0,
336 - page_num: 1 337 + PAGE_NUM: 1
337 }, parameter); 338 }, parameter);
338 -  
339 - if (parameter.REC_POSE === '' || parameter.PRD_ID === '') {  
340 - return true;  
341 - } 339 + delete parameter.isAppOp;
342 340
343 window._yas.sendCustomInfo({ 341 window._yas.sendCustomInfo({
344 op: 'YB_CHOOSE_FOR_YOU_Y', 342 op: 'YB_CHOOSE_FOR_YOU_Y',
  343 + appop: isAppOp ? 'YB_CHOOSE_FOR_YOU' : '', // app内打开wap的埋点场合
345 param: JSON.stringify(parameter) 344 param: JSON.stringify(parameter)
346 }, true); 345 }, true);
347 } 346 }
@@ -111,13 +111,14 @@ plusstar = { @@ -111,13 +111,14 @@ plusstar = {
111 $dom = $(event.target).closest('.good-info'); 111 $dom = $(event.target).closest('.good-info');
112 index = $dom.index() + 1; 112 index = $dom.index() + 1;
113 window.givePoint({ 113 window.givePoint({
  114 + isAppOp: true,
114 CID: CID, 115 CID: CID,
115 REC_POSE: RECPOSE, 116 REC_POSE: RECPOSE,
116 PRD_ID: $dom.data('good-id'), 117 PRD_ID: $dom.data('good-id'),
117 ORDER_CODE: '', 118 ORDER_CODE: '',
118 PRD_NUM: index % that.common.pagesize === 0 ? that.common.pagesize : index % that.common.pagesize, 119 PRD_NUM: index % that.common.pagesize === 0 ? that.common.pagesize : index % that.common.pagesize,
119 ACTION_ID: 1, 120 ACTION_ID: 1,
120 - page_num: Math.ceil(index / that.common.pagesize) 121 + PAGE_NUM: Math.ceil(index / that.common.pagesize)
121 }); 122 });
122 } else if ($(event.target).closest('.banner-top').length > 0) { 123 } else if ($(event.target).closest('.banner-top').length > 0) {
123 // 头部banner楼层埋点 124 // 头部banner楼层埋点
@@ -279,13 +280,14 @@ plusstar = { @@ -279,13 +280,14 @@ plusstar = {
279 }); 280 });
280 281
281 window.givePoint({ 282 window.givePoint({
  283 + isAppOp: true,
282 CID: CID, 284 CID: CID,
283 REC_POSE: RECPOSE, 285 REC_POSE: RECPOSE,
284 PRD_ID: skn.join(','), 286 PRD_ID: skn.join(','),
285 ORDER_CODE: '', 287 ORDER_CODE: '',
286 PRD_NUM: that.common.pagesize, 288 PRD_NUM: that.common.pagesize,
287 ACTION_ID: 0, 289 ACTION_ID: 0,
288 - page_num: that.common.page - 1 290 + PAGE_NUM: that.common.page - 1
289 }); 291 });
290 292
291 $('.plusstar-resources .goods').append(data); 293 $('.plusstar-resources .goods').append(data);
@@ -31,14 +31,12 @@ $.get('/product/recommend-for-you/userCenter').then(function(html) { @@ -31,14 +31,12 @@ $.get('/product/recommend-for-you/userCenter').then(function(html) {
31 $recommendForYou.show(); 31 $recommendForYou.show();
32 } 32 }
33 33
34 -  
35 -  
36 window.givePoint({ 34 window.givePoint({
37 REC_POSE: 110004, 35 REC_POSE: 110004,
38 PRD_ID: PRDID.join(','), 36 PRD_ID: PRDID.join(','),
39 PRD_NUM: $('.recommend-for-you .good-info').length, 37 PRD_NUM: $('.recommend-for-you .good-info').length,
40 ACTION_ID: 0, 38 ACTION_ID: 0,
41 - page_num: 1 39 + PAGE_NUM: 1
42 }); 40 });
43 41
44 $recommendForYou.find('.good-info').on('click', 'a', function() { 42 $recommendForYou.find('.good-info').on('click', 'a', function() {
@@ -49,7 +47,7 @@ $.get('/product/recommend-for-you/userCenter').then(function(html) { @@ -49,7 +47,7 @@ $.get('/product/recommend-for-you/userCenter').then(function(html) {
49 PRD_ID: $(this).closest('.good-info').data('id'), 47 PRD_ID: $(this).closest('.good-info').data('id'),
50 PRD_NUM: index, 48 PRD_NUM: index,
51 ACTION_ID: 1, 49 ACTION_ID: 1,
52 - page_num: 1 50 + PAGE_NUM: 1
53 }); 51 });
54 52
55 return true; 53 return true;
@@ -17,28 +17,10 @@ var $recommendForYou = $('.recommend-for-you'), @@ -17,28 +17,10 @@ var $recommendForYou = $('.recommend-for-you'),
17 var RECID = (new Date().getTime() + '_H5_YOHOBUY_' + Math.floor(Math.random() * 1000000 + 1000000) + 17 var RECID = (new Date().getTime() + '_H5_YOHOBUY_' + Math.floor(Math.random() * 1000000 + 1000000) +
18 '_' + Math.floor(Math.random() * 1000000 + 1000000)); 18 '_' + Math.floor(Math.random() * 1000000 + 1000000));
19 19
20 -var C_ID, goodid, goodIds = [], 20 +var goodid,
  21 + goodIds = [],
21 prdLoad; 22 prdLoad;
22 23
23 -C_ID = window._ChannelVary[window.cookie('_Channel')];  
24 -  
25 -function yasRequest(PRD_ID, PRD_NUM, ACTION_ID) {  
26 - if (window._yas && window._yas.sendCustomInfo) {  
27 - window._yas.sendCustomInfo({  
28 - op: 'YB_CHOOSE_FOR_YOU_Y',  
29 - param: JSON.stringify({  
30 - REC_POSE: 100013,  
31 - REC_ID: RECID,  
32 - PRD_ID: PRD_ID,  
33 - PRD_NUM: PRD_NUM,  
34 - C_ID: C_ID,  
35 - ACTION_ID: ACTION_ID,  
36 - PAGE_NUM: 1  
37 - })  
38 - }, true);  
39 - }  
40 -}  
41 -  
42 function request() { 24 function request() {
43 if (requesting || end) { 25 if (requesting || end) {
44 return; 26 return;
@@ -48,13 +30,14 @@ function request() { @@ -48,13 +30,14 @@ function request() {
48 30
49 if (preferenceUrl) { 31 if (preferenceUrl) {
50 $.get(preferenceUrl).then(function(html) { 32 $.get(preferenceUrl).then(function(html) {
51 - if (typeof html !== 'string') { return; } 33 + if (typeof html !== 'string') {
  34 + return;
  35 + }
52 36
53 $recommendForYou.html(html.replace(/https?:/gi, '')).show(); 37 $recommendForYou.html(html.replace(/https?:/gi, '')).show();
54 lazyLoad($recommendForYou.find('img.lazy')); 38 lazyLoad($recommendForYou.find('img.lazy'));
55 39
56 // 为你优选埋点- 加载 40 // 为你优选埋点- 加载
57 -  
58 $('.goods-container').find('.good-info').each(function() { 41 $('.goods-container').find('.good-info').each(function() {
59 goodid = $(this).data('good-id'); 42 goodid = $(this).data('good-id');
60 43
@@ -65,14 +48,28 @@ function request() { @@ -65,14 +48,28 @@ function request() {
65 48
66 prdLoad = JSON.stringify(goodIds).replace(/\[|\]|/g, ''); 49 prdLoad = JSON.stringify(goodIds).replace(/\[|\]|/g, '');
67 50
68 - yasRequest(prdLoad, goodIds.length, 0); 51 + window.givePoint({
  52 + REC_POSE: 100013,
  53 + REC_ID: RECID,
  54 + PRD_ID: prdLoad,
  55 + PRD_NUM: goodIds.length,
  56 + ACTION_ID: 0,
  57 + PAGE_NUM: 1
  58 + });
69 59
70 // 点击商品 60 // 点击商品
71 $('.good-info').on('click', function() { 61 $('.good-info').on('click', function() {
72 var PRD_ID = $(this).data('good-id'), 62 var PRD_ID = $(this).data('good-id'),
73 PRD_NUM = $(this).index(); 63 PRD_NUM = $(this).index();
74 64
75 - yasRequest(PRD_ID, PRD_NUM, 1); 65 + window.givePoint({
  66 + REC_POSE: 100013,
  67 + REC_ID: RECID,
  68 + PRD_ID: PRD_ID,
  69 + PRD_NUM: PRD_NUM,
  70 + ACTION_ID: 1,
  71 + PAGE_NUM: 1
  72 + });
76 73
77 // return false; 74 // return false;
78 }); 75 });