yas-head.js
2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
var $ = require('yoho-jquery');
var yas = require('../common/data-yas');
exports.yasHead = function() {
/* 获取商品编码*/
function getPrdId() {
return +$('.main').data('id');
}
/* 点击商品详情页【立即购买】按钮时埋点*/
$('#buy-now').click(function() {
var num = +$('#num').text(),
color = $('.chose-color .colors .focus').find('.color-name').text(),
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')});
});
/* 点击到货通知按钮时*/
$('.trade-content .type-chose').on('click', '#enable-notify', function() {
yas.givePoint('YB_GDS_ARRIVAL_NOTICE_C', {PRD_ID: getPrdId()});
});
// 点击数量加减号埋点
$('#plus-num').click(function() {
yas.givePoint('YB_GDS_NUMBER_C', {PRD_ID: getPrdId(), TYPE: 1});
});
$('#minus-num').click(function() {
yas.givePoint('YB_GDS_NUMBER_C', {PRD_ID: getPrdId(), TYPE: 2});
});
};