Authored by 郝肖肖

男首和女首,猜你喜欢埋点

@@ -10,6 +10,9 @@ var $footer = $('#yoho-footer'), @@ -10,6 +10,9 @@ var $footer = $('#yoho-footer'),
10 $yohoPage = $('.yoho-page'), 10 $yohoPage = $('.yoho-page'),
11 $header = $('.yoho-header'); 11 $header = $('.yoho-header');
12 12
  13 +//为您优选-40位随机数指纹请求id
  14 +var RECID = new Date().getTime() + '_WEB_' + Math.floor(Math.random() * 10);
  15 +
13 function cookie(name) { 16 function cookie(name) {
14 var cookies = document.cookie, 17 var cookies = document.cookie,
15 cookieVal, 18 cookieVal,
@@ -272,6 +275,57 @@ function reMarginFooter(fixedElement) { @@ -272,6 +275,57 @@ function reMarginFooter(fixedElement) {
272 } 275 }
273 }()); 276 }());
274 277
  278 +//为您优选埋点 http://redmine.yoho.cn/issues/10117
  279 +function givePoint(parameter) {
  280 + var CID = 1;
  281 +
  282 + if (!window._yas.sendCustomInfo) {
  283 + return false;
  284 + }
  285 +
  286 + //男:1,女:2,潮童:3,创意生活:4
  287 + switch(cookie('_Channel')) {
  288 + case 'boys':
  289 + CID = 1;
  290 + break;
  291 + case 'girls':
  292 + CID = 2;
  293 + break;
  294 + case 'kids':
  295 + CID = 3;
  296 + break;
  297 + case 'lifestyle':
  298 + CID = 4;
  299 + break;
  300 + }
  301 +
  302 + parameter = $.extend({
  303 + 'REC_POSE': '',
  304 + 'REC_ID': RECID,
  305 + 'PRD_ID': '',
  306 + 'PRD_NUM': 0,
  307 + 'C_ID': CID,
  308 + 'ACTION_ID': 0,
  309 + 'page_num': 1
  310 + }, parameter);
  311 +
  312 + console.log({
  313 + 'op': 'YB_CHOOSE_FOR_YOU_Y',
  314 + 'uid': getUid(),
  315 + 'param': parameter
  316 + }, 'yas=WEB==');
  317 +
  318 + if (parameter.REC_POSE === '' || parameter.PRD_ID === '') {
  319 + return true;
  320 + }
  321 +
  322 + window._yas.sendCustomInfo({
  323 + 'op': 'YB_CHOOSE_FOR_YOU_Y',
  324 + 'uid': getUid(),
  325 + 'param': parameter
  326 + }, true);
  327 +}
  328 +
275 /*$(document).ready(function() { 329 /*$(document).ready(function() {
276 setTimeout(function() { 330 setTimeout(function() {
277 var arr = document.querySelectorAll('.buriedpoint').find('a'), 331 var arr = document.querySelectorAll('.buriedpoint').find('a'),
@@ -385,3 +439,5 @@ window.getShoppingKey = getShoppingKey; @@ -385,3 +439,5 @@ window.getShoppingKey = getShoppingKey;
385 window.rePosFooter = rePosFooter; 439 window.rePosFooter = rePosFooter;
386 440
387 window.reMarginFooter = reMarginFooter; 441 window.reMarginFooter = reMarginFooter;
  442 +
  443 +window.givePoint = givePoint;
@@ -19,7 +19,8 @@ module.exports = function(specificGender) { @@ -19,7 +19,8 @@ module.exports = function(specificGender) {
19 page = 0, 19 page = 0,
20 gender = null, 20 gender = null,
21 num, 21 num,
22 - url; 22 + url,
  23 + RECPOSE = '110001';
23 24
24 //The kidsType can be specified by the parameter. Add by @ZhaoBiao 25 //The kidsType can be specified by the parameter. Add by @ZhaoBiao
25 var kidsType = specificGender === 'kids' || $('.mobile-wrap').hasClass('kids-wrap') ? true : false, 26 var kidsType = specificGender === 'kids' || $('.mobile-wrap').hasClass('kids-wrap') ? true : false,
@@ -64,6 +65,13 @@ module.exports = function(specificGender) { @@ -64,6 +65,13 @@ module.exports = function(specificGender) {
64 url = '/product/recom/newPreference?template_id=' + $.queryString().template_id; 65 url = '/product/recom/newPreference?template_id=' + $.queryString().template_id;
65 } 66 }
66 67
  68 + //首页男生和女生,推荐位ID,埋点
  69 + if (window.location.pathname === '/boys') {
  70 + RECPOSE = '110001';
  71 + } else if (window.location.pathname === '/girls') {
  72 + RECPOSE = '110002';
  73 + }
  74 +
67 $curNav = $navList.children('.focus'); 75 $curNav = $navList.children('.focus');
68 76
69 if (lifestyleType) { 77 if (lifestyleType) {
@@ -114,7 +122,7 @@ module.exports = function(specificGender) { @@ -114,7 +122,7 @@ module.exports = function(specificGender) {
114 page: page + 1 122 page: page + 1
115 }, 123 },
116 success: function(data) { 124 success: function(data) {
117 - 125 + var PRDID = [];
118 if (data === ' ') { 126 if (data === ' ') {
119 searching = false; 127 searching = false;
120 loading.hideLoadingMask(); 128 loading.hideLoadingMask();
@@ -171,6 +179,19 @@ module.exports = function(specificGender) { @@ -171,6 +179,19 @@ module.exports = function(specificGender) {
171 179
172 $title[0].mlellipsis(2); 180 $title[0].mlellipsis(2);
173 }); 181 });
  182 +
  183 + //为您优选埋点 start
  184 + $(data).closest('.good-info').each(function() {
  185 + PRDID.push($(this).data('id'));
  186 + });
  187 + window.givePoint({
  188 + 'REC_POSE': RECPOSE,
  189 + 'PRD_ID': PRDID.join(','),
  190 + 'PRD_NUM': $(data).closest('.good-info').length,
  191 + 'ACTION_ID': 0,
  192 + 'page_num': page + 1
  193 + });
  194 + //为您优选埋点 end
174 }, 195 },
175 error: function() { 196 error: function() {
176 tip.show('网络断开连接了~'); 197 tip.show('网络断开连接了~');
@@ -199,4 +220,18 @@ module.exports = function(specificGender) { @@ -199,4 +220,18 @@ module.exports = function(specificGender) {
199 $(window).scroll(function() { 220 $(window).scroll(function() {
200 window.requestAnimationFrame(scrollHandler); 221 window.requestAnimationFrame(scrollHandler);
201 }); 222 });
  223 +
  224 + //为您优选埋点 http://redmine.yoho.cn/issues/10116
  225 + $('.maybe-like .goods-list').on('click', 'a', function() {
  226 + var index = $(this).closest('.good-info').index() + 1,
  227 + pageNum = 50;
  228 + window.givePoint({
  229 + 'REC_POSE': RECPOSE,
  230 + 'PRD_ID': $(this).closest('.good-info').data('id'),
  231 + 'PRD_NUM': index % pageNum === 0 ? pageNum : index % pageNum,
  232 + 'ACTION_ID': 1,
  233 + 'page_num': Math.ceil(index / pageNum)
  234 + });
  235 + return false;
  236 + });
202 }; 237 };