Authored by wenjiekong

添加埋点

... ... @@ -60,6 +60,50 @@ identityFn = handlebars.compile($('#identity-back').html() || '');
require('../plugins/slider');
/** *埋点方法***/
function givePoint(op, parameter) {
var CID = 1;
if (!window._yas || !window._yas.sendCustomInfo) {
return false;
}
// 男:1,女:2,潮童:3,创意生活:4
switch (document.cookie('_Channel')) {
case 'boys':
CID = 1;
break;
case 'girls':
CID = 2;
break;
case 'kids':
CID = 3;
break;
case 'lifestyle':
CID = 4;
break;
default:
CID = 1;
}
parameter = $.extend({
REC_POSE: '',
PRD_ID: '',
PRD_NUM: 0,
C_ID: CID,
ACTION_ID: 0,
page_num: 1
}, parameter);
if (parameter.REC_POSE === '' || parameter.PRD_ID === '') {
return true;
}
window._yas.sendCustomInfo({
op: op,
param: JSON.stringify(parameter)
}, true);
}
function createStuDialog(cont) {
var opt = {
className: 'stu-dialog',
... ... @@ -106,8 +150,8 @@ function clearSelectUl($a, code) {
* 最终提交表单
*/
function submitIdentity(json) {
//xls-3提交认证埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 1});
// xls-3提交认证埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 1});
$.ajax({
type: 'GET',
url: '/product/students/verify',
... ... @@ -115,14 +159,16 @@ function submitIdentity(json) {
}).then(function(data) {
if (data.code === 200) {
window.location.href = data.data;
//xls-4认证成功埋点
givePoint('YB_STUDENT_ATTCT_RESULT',{SRC_ID: 5, SUBMIT_RES: 1});
// xls-4认证成功埋点
givePoint('YB_STUDENT_ATTCT_RESULT', {SRC_ID: 5, SUBMIT_RES: 1});
} else {
$identityForm.addClass('hide');
$('identity-back-wrap').remove();
$identityWrap.append(identityFn({msg: data.message}));
//xls-4认证失败埋点
givePoint('YB_STUDENT_ATTCT_RESULT',{SRC_ID: 5, SUBMIT_RES: 2,FAILURE_CAUSE: data.message});
// xls-4认证失败埋点
givePoint('YB_STUDENT_ATTCT_RESULT', {SRC_ID: 5, SUBMIT_RES: 2, FAILURE_CAUSE: data.message});
}
});
}
... ... @@ -378,8 +424,8 @@ $rightDia.on('click', function() {
createStuDialog(cont);
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-rights-box', F_NAME: '学生权益',
// xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'stu-rights-box', F_NAME: '学生权益',
F_URL: '', F_INDEX: 2, I_INDEX: 0});
});
... ... @@ -423,8 +469,8 @@ $('.enable .info').on('click', function(e) {
requestCoupon($(this).closest('a').data('id'));
redirect.gunangSrc = $(this).closest('a').get(0).href;
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-coupon-box', F_NAME: '优惠券',
// xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'stu-coupon-box', F_NAME: '优惠券',
F_URL: '', F_INDEX: 4, I_INDEX: 0});
});
... ... @@ -444,57 +490,65 @@ $('#identity-Btn').on('click', function() {
if (identData.name === '') {
failText = '真实姓名不能为空';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
// xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
if (!/^[\u4e00-\u9fa5a-zA-Z]{2,12}$/.test(identData.name)) {
failText = '真实姓名为2~12个汉字或者英文';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
// xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
if (identData.certNo === '') {
failText = '身份证号不能为空';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
// xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
if (!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identData.certNo)) {
failText = '身份证号格式错误';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
// xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
if (identData.collegeName === '') {
failText = '学校名称不能为空';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
// xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
if (identData.educationDegree === '') {
failText = '学历程度不能为空';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
// xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
if (identData.enrollmentYear === '') {
failText = '入学年份不能为空';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
// xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
if (!$agreen.hasClass('active')) {
failText = '未同意Yoho!有货学生认证协议';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
// xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT', {SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
$prompt.html('');
... ... @@ -506,118 +560,73 @@ $('.ident-select-wrap').one('click', function() {
$(this).removeClass('gray-p');
});
function givePoint(op,parameter) {
var CID = 1;
if (!window._yas || !window._yas.sendCustomInfo) {
return false;
}
//男:1,女:2,潮童:3,创意生活:4
switch(cookie('_Channel')) {
case 'boys':
CID = 1;
break;
case 'girls':
CID = 2;
break;
case 'kids':
CID = 3;
break;
case 'lifestyle':
CID = 4;
break;
}
parameter = $.extend({
'REC_POSE': '',
'PRD_ID': '',
'PRD_NUM': 0,
'C_ID': CID,
'ACTION_ID': 0,
'page_num': 1
}, parameter);
if (parameter.REC_POSE === '' || parameter.PRD_ID === '') {
return true;
}
console.info(parameter);
window._yas.sendCustomInfo({
'op': op,
'uid': getUid(),
'param': JSON.stringify(parameter)
}, true);
}
/*
*埋点
*/
$(function(){
  
if ($('#identity-success').length >0) {
//xls-4学生认证成功埋点
givePoint('YB_STUDENT_ATTCT_RESULT',{SRC_ID: 5, SUBMIT_RES: 1});
$(function() {
if ($('#identity-success').length > 0) {
// xls-4学生认证成功埋点
givePoint('YB_STUDENT_ATTCT_RESULT', {SRC_ID: 5, SUBMIT_RES: 1});
}
if ($('#identity-fail').length >0) {
//xls-4学生认证失败埋点
givePoint('YB_STUDENT_ATTCT_RESULT',{SRC_ID: 5, SUBMIT_RES: 2,
if ($('#identity-fail').length > 0) {
// xls-4学生认证失败埋点
givePoint('YB_STUDENT_ATTCT_RESULT', {SRC_ID: 5, SUBMIT_RES: 2,
FAILURE_CAUSE: $('#identity-fail-text').html()});
}
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_HOME',{SRC_ID: 5});
// xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_HOME', {SRC_ID: 5});
$('.banner-img').click(function(){
$('.banner-img').click(function() {
var url = $(this).children().attr('href'),
index = $(this).index();
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'banner', F_NAME: 'banner',
F_URL: url, F_INDEX: 1, I_INDEX: parseInt(index)+1});
// xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'banner', F_NAME: 'banner',
F_URL: url, F_INDEX: 1, I_INDEX: parseInt(index, 0) + 1});
});
$('#stu-coupon-more').click(function(){
$('#stu-coupon-more').click(function() {
var url = $(this).attr('href');
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-coupon-box', F_NAME: '优惠券',
// xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'stu-coupon-box', F_NAME: '优惠券',
F_URL: url, F_INDEX: 4, I_INDEX: 0});
});
$('#stu-good-more').click(function(){
$('#stu-good-more').click(function() {
var url = $(this).attr('href');
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-good-box', F_NAME: '热门单品',
// xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'stu-good-box', F_NAME: '热门单品',
F_URL: url, F_INDEX: 5, I_INDEX: 0});
});
$('.good-thumb').click(function(){
$('.good-thumb').click(function() {
var url = $(this).attr('href'),
index = $(this).closest('.good-info').index();
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-good-box', F_NAME: '热门单品',
F_URL: url, F_INDEX: 5, I_INDEX: parseInt(index)+1});
// xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'stu-good-box', F_NAME: '热门单品',
F_URL: url, F_INDEX: 5, I_INDEX: parseInt(index, 0) + 1});
});
$('.stu-good-detail a').click(function(){
$('.stu-good-detail a').click(function() {
var url = $(this).attr('href'),
index = $(this).closest('.good-info').index();
console.info(index);
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-good-box', F_NAME: '热门单品',
F_URL: url, F_INDEX: 5, I_INDEX: parseInt(index)+1});
// xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'stu-good-box', F_NAME: '热门单品',
F_URL: url, F_INDEX: 5, I_INDEX: parseInt(index, 0) + 1});
});
$('.commodity-list a').click(function(){
$('.commodity-list a').click(function() {
var url = $(this).attr('href'),
index = $(this).index();
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-activity-box', F_NAME: '活动推荐',
F_URL: url, F_INDEX: 6, I_INDEX: parseInt(index)+1});
// xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR', {F_ID: 'stu-activity-box', F_NAME: '活动推荐',
F_URL: url, F_INDEX: 6, I_INDEX: parseInt(index, 0) + 1});
});
});
... ...