Authored by mark

埋点

... ... @@ -20,8 +20,8 @@ module.exports = {
// test2
singleApi: 'http://192.168.102.27:8092/brower',
api: 'http://api-test2.yohops.com:9999/',
service: 'http://service-test2.yohops.com:9999/',
api: 'http://api-test2.yohops.com:9999/',
service: 'http://service-test2.yohops.com:9999/'
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/'
... ...
... ... @@ -1470,7 +1470,7 @@ $('.package-box').on('click', '#buy-detail', function() {
$pkgColor.html('"' + $colorName.html() + '"');
if($pkSizesUl.eq(index).find('li.focus').length > 0) {
if ($pkSizesUl.eq(index).find('li.focus').length > 0) {
selectedSize = '"' + $pkSizesUl.eq(index).find('li.focus').html() + '码"';
}
$pkgSize.html(selectedSize);
... ... @@ -1613,251 +1613,253 @@ bindEvent.fire();
});
}());
$(window).scroll(function() {
var sc = $(document);
var win = $(window);
var scrollStart = $('.other-infos').offset().top;
var scrollBottom = sc.height() - $('#after-service-switch').offset().top;
var scrollEnd = $('#textbox').offset().top;
$(window).scroll(function() {
var sc = $(document);
var win = $(window);
var scrollStart = $('.other-infos').offset().top;
var scrollBottom = sc.height() - $('#after-service-switch').offset().top;
var scrollEnd = $('#textbox').offset().top;
if (sc.scrollTop() >= scrollStart && sc.scrollTop() <= scrollEnd) {
$('.shoppingCar').addClass('fixednav');
} else {
$('.shoppingCar').removeClass('fixednav');
}
if (sc.scrollTop() >= scrollStart && sc.scrollTop() <= scrollEnd) {
$('.shoppingCar').addClass('fixednav');
} else {
$('.shoppingCar').removeClass('fixednav');
}
if (sc.height() - win.height() - sc.scrollTop() <= scrollBottom) {
$('.shoppingCar').height(win.height() - (scrollBottom + win.height() + sc.scrollTop() - sc.height()));
if (sc.height() - win.height() - sc.scrollTop() <= scrollBottom) {
$('.shoppingCar').height(win.height() - (scrollBottom + win.height() + sc.scrollTop() - sc.height()));
} else {
$('.shoppingCar').height(1000);
}
} else {
$('.shoppingCar').height(1000);
}
$('.getnav').each(function(i, ele) {
$('.getnav').each(function(i, ele) {
var data;
var data;
if ($(ele).offset().top - $(window).scrollTop() < 100) {
data = $(ele).data('id');
$('.shoppingCar-nav li:eq(' + data + ')').siblings().find('a').removeClass('fixed');
$('.shoppingCar-nav li:eq(' + data + ')').find('a').addClass('fixed');
if ($(ele).offset().top - $(window).scrollTop() < 100) {
data = $(ele).data('id');
$('.shoppingCar-nav li:eq(' + data + ')').siblings().find('a').removeClass('fixed');
$('.shoppingCar-nav li:eq(' + data + ')').find('a').addClass('fixed');
}
});
}
});
});
});
$('.shoppingCar').on('click', '.option', function(e) {
var $this = $(this);
$('.shoppingCar').on('click', '.option', function(e) {
var $this = $(this);
if ($this.hasClass('fixed')) {
return;
}
if ($this.hasClass('fixed')) {
return;
}
$this.closest('li').siblings().find('.option').removeClass('fixed');
$this.addClass('fixed');
$this.closest('li').siblings().find('.option').removeClass('fixed');
$this.addClass('fixed');
if ($this.hasClass('comment')) {
window.fetchComment();
} else if ($this.hasClass('consult')) {
window.fetchConsult();
}
if ($this.hasClass('comment')) {
window.fetchComment();
} else if ($this.hasClass('consult')) {
window.fetchConsult();
}
e.stopPropagation();
});
e.stopPropagation();
});
$('.shoppingCar-btn').on('click', function() {
var $addToCart = $('#add-to-cart');
var sc = $(document);
$('.shoppingCar-btn').on('click', function() {
var $addToCart = $('#add-to-cart');
var sc = $(document);
if (maxStock === -1) {
sc.scrollTop(200);
if (maxStock === -1) {
sc.scrollTop(200);
} else {
$addToCart.trigger('click');
}
});
$(function() {
$('.bottom-tab .change').click(function() {
$('.img-brand-switch .next').trigger('click');
});
});
$(function() {
var font = $('.description-content .basic li');
$('.size-table tbody tr:odd td').css('background-color', '#f9f9f9');
font.each(function(i, ele) {
if ((i + 1) % 4 === 0) {
$(this).find('.justpostion').css({display: 'inline-block', 'margin-left': '40px'});
} else if ((i + 1) % 4 === 1) {
return;
} else {
$addToCart.trigger('click');
$(this).find('.justpostion').css('margin-left', '56px');
}
});
$(function() {
$('.bottom-tab .change').click(function() {
$('.img-brand-switch .next').trigger('click');
});
});
$(function() {
var font = $('.description-content .basic li');
$('.size-table tbody tr:odd td').css('background-color','#f9f9f9');
font.each(function(i, ele) {
if ((i + 1) % 4 === 0) {
$(this).find('.justpostion').css({display: 'inline-block', 'margin-left': '40px'});
} else if ((i + 1) % 4 === 1) {
return;
} else {
$(this).find('.justpostion').css('margin-left', '56px');
}
});
});
/*获取商品编码*/
function getPrdId(){
return +$('.main').data('id');
}
/*点击商品详情页【立即购买】按钮时埋点*/
$('#buy-now').click(function(){
var num = +$('#num').text();
var color = $('.chose-color .colors .focus').find('color-name').text();
var size = $('#sizes .size .focus').data('name');
var option = {
PRD_ID : getPrdId(),
PRD_NUM : num,
COLOR : color,
SIZE : size
}
yas.givePoint('YB_GDS_BUY_NOW_C',option);
});
/*点击商品详情页商品角度图时埋点*/
$('#thumbs > .thumb-wrap').on('click', '.thumb', function(){
var $this = $(this);
var $index = $this.index()+1;
yas.givePoint('YB_GDS_PICTURE_C', {PRD_ID: getPrdId(), PIC_INDEX: $index});
});
/*点击商品分享渠道时埋点*/
$('.share-row .share-to i').on('click',function(){
var $this = $(this);
var $index = $this.index()+1;
yas.givePoint('YB_GDS_SHARE_TYPE_C', {PRD_ID: getPrdId(), TYPE_ID: $index});
});
/*查看VIP价格后的【立即登录】按钮点击埋点*/
$('.market-price .vip-price a').click(function(){
yas.givePoint('YB_GDS_VIP_PRICE_SIGN_C', {PRD_ID: getPrdId()});
});
/*点击【展开全部促销】按钮时*/
$('.activity-wrapper .activity-title').click(function(){
yas.givePoint('YB_GDS_ALL_PROMOTION_C', { PRD_ID: getPrdId() });
});
/*点击优惠券领取模块埋点*/
$('.small-coupon-list li .coupon-item .small-desc').click(function(){
var $this = $(this);
var coupon = $this.parent('.coupon-item').data('id');
yas.givePoint('YB_GDS_COUPON_C', {PRD_ID: getPrdId(), COUPON: coupon});
});
/*点击商品详情页颜色时*/
$('.chose-color .colors').on('click', 'li', function(){
var $this = $(this);
var color = $this.find('color-name').text();
yas.givePoint('YB_GDS_COLOR_C', {PRD_ID: getPrdId(), COLOR: color});
});
/*点击商品详情页尺寸时埋点*/
$('#sizes .size').on('click', 'li', function(){
var $this = $(this);
yas.givePoint('YB_GDS_SIZE_C', {PRD_ID: getPrdId(), SIZE: $this.data('name')});
});
/*点击商品详情页模块导航时埋点*/
$('.shoppingCar .shoppingCar-nav ul').on('click', 'li', function(){
var $this = $(this);
var $index = $this.index()+1;
yas.givePoint('YB_GDS_NAVIGATION_C', {PRD_ID: getPrdId(), NAV_INDE: $index});
});
/*点击商品评价模块中的全部/有图/图片时埋点*/
$('.cc-content .comment-tabs').on('click', 'h2', function(){
var $this = $(this);
var $index = $this.index()+1;
yas.givePoint('YB_GDS_REVIEWS_TAB_C', {PRD_ID: getPrdId(), POS_ID: $index});
});
$('.comments').on('click', '.img-preview .img-thumb', function() {
yas.givePoint('YB_GDS_REVIEWS_TAB_C', {PRD_ID: getPrdId(), POS_ID: 3});
});
/*点击商品详情页中的【我要咨询】时埋点*/
$('#submit-consult').click(function(){
yas.givePoint('YB_GDS_CONSULT_C', {PRD_ID: getPrdId()});
});
/*点击商品详情页底部店铺推荐和最近浏览TAB时埋点*/
$('.bottom-tab p').on('click', 'span', function(){
var $this = $(this);
var $index = $this.index()+1;
if( $index !== 3){
yas.givePoint('YB_GDS_RECOMMEND_REVIEW_TAB_C', {PRD_ID: getPrdId(), TAB_ID: $index});
}
});
/*点击商品详情页底部店铺推荐和最近浏览中的商品时*/
$('.recommend-content .img-list').on('click', 'li', function(){
var $this = $(this);
var relatedID = +$this.find('.goods-id').text();
var option = {
PRD_ID: getPrdId(),
RELATED_ID: relatedID,
TAB_ID : 1
};
yas.givePoint('YB_GDS_RECOMMEND_REVIEW_GOODS_C', option);
});
});
/* 获取商品编码*/
function getPrdId() {
return +$('.main').data('id');
}
/* 点击商品详情页【立即购买】按钮时埋点*/
$('#buy-now').click(function() {
var num = +$('#num').text();
var color = $('.chose-color .colors .focus').find('color-name').text();
var size = $('#sizes .size .focus').data('name');
var option = {
PRD_ID: getPrdId(),
PRD_NUM: num,
COLOR: color,
SIZE: size
};
yas.givePoint('YB_GDS_BUY_NOW_C', option);
});
/* 点击商品详情页商品角度图时埋点*/
$('#thumbs > .thumb-wrap').on('click', '.thumb', function() {
var $this = $(this);
var $index = $this.index() + 1;
yas.givePoint('YB_GDS_PICTURE_C', {PRD_ID: getPrdId(), PIC_INDEX: $index});
});
/* 点击商品分享渠道时埋点*/
$('.share-row .share-to i').on('click', function() {
var $this = $(this);
var $index = $this.index() + 1;
yas.givePoint('YB_GDS_SHARE_TYPE_C', {PRD_ID: getPrdId(), TYPE_ID: $index});
});
$('#latest-walk-goods').on('click', '.good', function(){
/* 查看VIP价格后的【立即登录】按钮点击埋点*/
$('.market-price .vip-price a').click(function() {
yas.givePoint('YB_GDS_VIP_PRICE_SIGN_C', {PRD_ID: getPrdId()});
});
/* 点击【展开全部促销】按钮时*/
$('.activity-wrapper .activity-title').click(function() {
yas.givePoint('YB_GDS_ALL_PROMOTION_C', { PRD_ID: getPrdId() });
});
/* 点击优惠券领取模块埋点*/
$('.small-coupon-list li .coupon-item .small-desc').click(function() {
var $this = $(this);
var coupon = $this.parent('.coupon-item').data('id');
yas.givePoint('YB_GDS_COUPON_C', {PRD_ID: getPrdId(), COUPON: coupon});
});
/* 点击商品详情页颜色时*/
$('.chose-color .colors').on('click', 'li', function() {
var $this = $(this);
var color = $this.find('color-name').text();
yas.givePoint('YB_GDS_COLOR_C', {PRD_ID: getPrdId(), COLOR: color});
});
/* 点击商品详情页尺寸时埋点*/
$('#sizes .size').on('click', 'li', function() {
var $this = $(this);
yas.givePoint('YB_GDS_SIZE_C', {PRD_ID: getPrdId(), SIZE: $this.data('name')});
});
/* 点击商品详情页模块导航时埋点*/
$('.shoppingCar .shoppingCar-nav ul').on('click', 'li', function() {
var $this = $(this);
var $index = $this.index() + 1;
yas.givePoint('YB_GDS_NAVIGATION_C', {PRD_ID: getPrdId(), NAV_INDE: $index});
});
/* 点击商品评价模块中的全部/有图/图片时埋点*/
$('.cc-content .comment-tabs').on('click', 'h2', function() {
var $this = $(this);
var $index = $this.index() + 1;
yas.givePoint('YB_GDS_REVIEWS_TAB_C', {PRD_ID: getPrdId(), POS_ID: $index});
});
$('.comments').on('click', '.img-preview .img-thumb', function() {
yas.givePoint('YB_GDS_REVIEWS_TAB_C', {PRD_ID: getPrdId(), POS_ID: 3});
});
/* 点击商品详情页中的【我要咨询】时埋点*/
$('#submit-consult').click(function() {
yas.givePoint('YB_GDS_CONSULT_C', {PRD_ID: getPrdId()});
});
/* 点击商品详情页底部店铺推荐和最近浏览TAB时埋点*/
$('.bottom-tab p').on('click', 'span', function() {
var $this = $(this);
var $index = $this.index() + 1;
if ($index !== 3) {
yas.givePoint('YB_GDS_RECOMMEND_REVIEW_TAB_C', {PRD_ID: getPrdId(), TAB_ID: $index});
}
});
/* 点击商品详情页底部店铺推荐和最近浏览中的商品时*/
$('.recommend-content .img-list').on('click', 'li', function() {
var $this = $(this);
var relatedID = +$this.find('.goods-id').text();
var option = {
PRD_ID: getPrdId(),
RELATED_ID: relatedID,
TAB_ID: 1
};
yas.givePoint('YB_GDS_RECOMMEND_REVIEW_GOODS_C', option);
});
$('#latest-walk-goods').on('click', '.good', function() {
var $this = $(this);
var relatedID = +$this.find('a').attr('href').split('_')[1];
var option = {
PRD_ID: getPrdId(),
RELATED_ID: relatedID,
TAB_ID: 2
};
yas.givePoint('YB_GDS_RECOMMEND_REVIEW_GOODS_C', option);
});
/* 点击商品详情页底部店铺推荐和最近浏览中的【换一换】按钮时埋点*/
$('.bottom-tab .change').click(function() {
yas.givePoint('YB_GDS_RECOMMEND_REVIEW_CHANGE_C', {PRD_ID: getPrdId(), TAB_ID: 1});
});
/* 点击商品详情页中套餐资源位任意区域时埋点*/
$('#package').click(function() {
yas.givePoint('YB_GDS_PACKAGE_C', {PRD_ID: getPrdId()});
});
/* 点击套餐详情页中的商品时埋点*/
$('.package-box').on('click', '.package-pro .good-info', function() {
var $this = $(this);
var $index = $this.index() === 0 ? $this.index() + 1 : ($this.index() / 2) + 1;
var id = $this.find('.good-thumb').attr('href').split('_')[1];
var option = {
PRD_ID: getPrdId(),
PACKAGE_GOODS: id,
PACKAGE_INDEX: $index
};
yas.givePoint('YB_GDS_PACKAGE_GOODS_C', option);
});
/* 点击套餐详情页中的立即购买按钮时埋点*/
$('.package-box').on('click', '#buy-detail', function() {
var arr = [];
var good = $('.package-box .package-pro').find('.good-info');
good.each(function(i, ele) {
var $this = $(this);
var relatedID = +$this.find('a').attr('href').split('_')[1];
var option = {
PRD_ID: getPrdId(),
RELATED_ID: relatedID,
TAB_ID : 2
};
yas.givePoint('YB_GDS_RECOMMEND_REVIEW_GOODS_C', option);
var id = $this.find('.good-thumb').attr('href').split('_')[1];
arr.push(id);
});
/*点击商品详情页底部店铺推荐和最近浏览中的【换一换】按钮时埋点*/
$('.bottom-tab .change').click(function(){
yas.givePoint('YB_GDS_RECOMMEND_REVIEW_CHANGE_C',{PRD_ID: getPrdId(), TAB_ID: 1});
yas.givePoint('YB_GDS_PACKAGE_BUY_NOW_C', {
PRD_ID: getPrdId(),
PACKAGE_GOODS: arr.join(';')
});
});
/*点击商品详情页中套餐资源位任意区域时埋点*/
$('#package').click(function(){
yas.givePoint('YB_GDS_PACKAGE_C',{PRD_ID: getPrdId()});
});
/*点击套餐详情页中的商品时埋点*/
$('.package-box').on('click', '.package-pro .good-info', function(){
var $this = $(this);
var $index = $this.index() === 0? $this.index()+1 : ($this.index()/2)+1;
var id = $this.find('.good-thumb').attr('href').split('_')[1];
var option = {
PRD_ID: getPrdId(),
PACKAGE_GOODS: id,
PACKAGE_INDEX: $index
}
yas.givePoint('YB_GDS_PACKAGE_GOODS_C', option);
});
/*点击套餐详情页中的立即购买按钮时埋点*/
$('.package-box').on('click', '#buy-detail', function() {
var arr = [];
var good = $('.package-box .package-pro').find('.good-info');
good.each(function(i,ele){
var $this = $(this);
var id = $this.find('.good-thumb').attr('href').split('_')[1];
arr.push(id);
});
yas.givePoint('YB_GDS_PACKAGE_BUY_NOW_C',{
PRD_ID: getPrdId(),
PACKAGE_GOODS:arr.join(';')
});
});
$('.trade-content .type-chose').on('click', '#enable-notify', function(){
yas.givePoint('YB_GDS_ARRIVAL_NOTICE_C', {PRD_ID: getPrdId()});
});
$('.trade-content .type-chose').on('click', '#enable-notify', function() {
yas.givePoint('YB_GDS_ARRIVAL_NOTICE_C', {PRD_ID: getPrdId()});
});
// 数据懒加载
dataLazyLoad.init({cls: '.datalazyload', threshold: 0});
dataLazyLoad.init({cls: '.datalazyload', threshold: 0});
... ...