神策
2019-01-09 本文已影响0人
黑色的五叶草
如果需要调用 login 来重新设置用户标识,必须在此之前调用
sensors.quick('autoTrack')
监听 hashchange 和 popstate 方式 (不建议使用) hashchange 这种切换 url 的方式已经用的越来越少了。不过这种方式的页面切换,是可以自动监听到的。popstate 这个事件可以监听,但是因为只有在浏览器前进后退才会触发,页面跳转并不会触发,所以意义不大。针对上面这两种能自动监听到的事件,我们提供了 is_single_page的参数配置,只要设置 is_single_page:true 就会自动在监听到 hashchange 或 popstate 事件,并自动发送页面浏览数据。
// 下面演示点击图片的时候也触发点击图事件
$('img').on('click',function(){
sensors.quick('trackHeatMap',this); //第二个参数是发生事件的dom元素
});
// 坑位点击
var trackMktEvent = function(t, pageTitle, id, l, n, ml, itemId){
sensors.track('mkt_event', {
mkt_type: t, // 坑位类型
mkt_campaign: pageTitle, // 坑位所在页面
// module_ID: id, // 模块ID
module_location: l, // 模块排序位置
content_name: n, // 内容名称
mkt_location: ml, // 内容排序位置
box_id: boxId // 内容商品ID
})
};
// 为后端提供sensors埋点入口来源
var sensorsParameter = function () {
var t = '',
pageTitle = '',
id = -1,
l = '',
n = '',
ml = '',
boxId = -1;
$('.userinfor-menu > li').on('click', function () {
t = 'web一级页面顶部各tab';
pageTitle: '我的-个人中心';
n = $(this).find('a').text();
ml = $(this).index() + 1;
trackMktEvent(t, pageTitle, id, l, n, ml, itemId);
});
}
// 神策埋点坑位点击
var trackMktEvent = function(t, pageTitle, id, l, n, ml, itemId){
sensors.track('mkt_event', {
mkt_type: t, // 坑位类型
mkt_campaign: pageTitle, // 坑位所在页面
module_id: id, // 模块ID
module_location: l, // 模块排序位置
content_name: n, // 内容名称
mkt_location: ml, // 内容排序位置
item_box_id: itemId // 内容商品ID
})
};
// 为后端提供sensors埋点入口来源
var sensorsParameter = function(){
var t = '',
pageTitle = 'wap一级货架页',
id = '',
l = '',
n = '',
ml = '',
itemId = -1;
// 为各个商品添加'?preseat=9'后缀
// $('.index-goods-box a').each(function () {
// var oldHref = $(this).attr('href');
// oldHref.indexOf('/item/') > -1 && $(this).attr('href', oldHref+'?preseat=9');
// });
$('.banner-ct a').on('click', function () {
t = '移动端一级分类',
n = '全部',
ml = $(this).index() + 1;
itemId = $(this).attr('tagid');
trackMktEvent(t, pageTitle, id, l, n, ml, itemId);
});
};
wap 二级货架页商品页面
htm: src/main/webapp/WEB-INF/views/freagment/screening/screening_box.html
js: src/main/webapp/WEB-INF/views/h5/item/screening_new.html
{
"count": 518,
"more": true,
"talks": [{
"canReply": true,
"comment": false,
"common": false,
"content": "简单的颜色和设计简约风格客厅的秘诀。精简的设计让客厅更显整洁。组合转角沙发让房间看起来更有重点,也更加和谐。 ",
"ctime": 1481205545000,
"groupId": 300100,
"id": 4273,
"itemCommentImgs": [{
"commentId": 4273,
"cover": false,
"createTime": 1485007169000,
"disabled": false,
"height": 1066,
"id": 8868,
"itemId": 300100,
"md5": "082129285d94b04f51c039df82511a03",
"userId": 63669,
"userName": "seven",
"width": 1600
}, {
"commentId": 4273,
"cover": true,
"createTime": 1485007169000,
"disabled": false,
"height": 1066,
"id": 8869,
"itemId": 300100,
"md5": "9dcc4562fac2d77971aa2e5cd34c649f",
"userId": 63669,
"userName": "seven",
"width": 1600
}],
"itemId": 300100,
"kuanXing": "转角三人座",
"needShowAll": false,
"reply": "很简单的一句评价但包含了很多内容^_^ 非常感谢您的认可,造作欢迎您常来看看!",
"selected": true,
"shaidan": true,
"shaidanCouponVal": 691.00,
"shortContent": "简单的颜色和设计简约风格客厅的秘诀。精简的设计让客厅更显整洁。组合转角沙发让房间看起来更有重点,也更加和谐。 ",
"type": "item_comment",
"userImg": "63eca221512e1b4ab191286f69658ee4",
"userName": "seven",
"userRole": "",
"userSelected": true
}, {
"canReply": true,
"comment": false,
"common": false,
"content": "质颜色搭配请了造作推荐。装好后很喜欢。质量很好,售后很好,365安装的宋师傅服务特别好。值得拥有。",
"ctime": 1545471079000,
"groupId": 300100,
"id": 39047,
"itemCommentImgs": [{
"commentId": 39047,
"cover": true,
"createTime": 1545471450000,
"disabled": false,
"height": 912,
"id": 103738,
"itemId": 300100,
"md5": "u/221074/7ee4768ac97f89aff3edec500f12092d",
"userId": 221074,
"userName": "MISS吕",
"width": 1216
}, {
"commentId": 39047,
"cover": false,
"createTime": 1545471450000,
"disabled": false,
"height": 912,
"id": 103739,
"itemId": 300100,
"md5": "u/221074/11c84e9e327dc43929edba38a0f62016",
"userId": 221074,
"userName": "MISS吕",
"width": 1216
}],
"itemId": 300100,
"kuanXing": "转角大三人座",
"needShowAll": false,
"selected": true,
"shaidan": true,
"shaidanCouponVal": 690.00,
"shortContent": "质颜色搭配请了造作推荐。装好后很喜欢。质量很好,售后很好,365安装的宋师傅服务特别好。值得拥有。",
"type": "item_comment",
"userImg": "c50a45cd1f8740671bb3f34678366d2a",
"userName": "MISS吕",
"userRole": "",
"userSelected": true
}, {
"canReply": true,
"comment": false,
"common": false,
"content": "大先生沙发墩,真的是大大大,坐在上面躺在上面超舒服,新到拆开后也没味道,超级棒。",
"ctime": 1545315082000,
"groupId": 300100,
"id": 38905,
"itemCommentImgs": [{
"commentId": 38905,
"cover": false,
"createTime": 1545315082000,
"disabled": false,
"height": 845,
"id": 103293,
"itemId": 300100,
"md5": "u/385670/d1485f7820859c715c5f49084430d4ad",
"userId": 385670,
"userName": "hongdian",
"width": 1283
}, {
"commentId": 38905,
"cover": false,
"createTime": 1545315082000,
"disabled": false,
"height": 761,
"id": 103294,
"itemId": 300100,
"md5": "u/385670/e73261cfa7a64343d00919a87505309a",
"userId": 385670,
"userName": "hongdian",
"width": 1243
}],
"itemId": 300100,
"kuanXing": "脚墩",
"needShowAll": false,
"selected": true,
"shaidan": true,
"shaidanCouponVal": 53.00,
"shortContent": "大先生沙发墩,真的是大大大,坐在上面躺在上面超舒服,新到拆开后也没味道,超级棒。",
"type": "item_comment",
"userImg": "32bf334d81726ba05ccb7914f56423e2",
"userName": "hongdian",
"userRole": "",
"userSelected": true
}, {
"canReply": true,
"comment": false,
"common": false,
"content": "双十一收的,喜欢!所有垫子拿掉可以做单人床,宽敞。颜色也低调洋气,家里有了色彩,但又自然的融合在一起,开心!",
"ctime": 1545143998000,
"groupId": 300100,
"id": 38730,
"itemCommentImgs": [{
"commentId": 38730,
"cover": false,
"createTime": 1545143998000,
"disabled": false,
"height": 810,
"id": 102833,
"itemId": 300100,
"md5": "u/439687/1cc23a1ba71fe6d24b86e60b75172b93",
"userId": 439687,
"userName": "文小刀",
"width": 1080
}, {
"commentId": 38730,
"cover": false,
"createTime": 1545143998000,
"disabled": false,
"height": 810,
"id": 102834,
"itemId": 300100,
"md5": "u/439687/db8ec2b6e79c21e3f4ad1fbaaa5f8e69",
"userId": 439687,
"userName": "文小刀",
"width": 1080
}, {
"commentId": 38730,
"cover": true,
"createTime": 1545143998000,
"disabled": false,
"height": 810,
"id": 102835,
"itemId": 300100,
"md5": "u/439687/6873d8ef822daef79e2f3030b6e4b28a",
"userId": 439687,
"userName": "文小刀",
"width": 1080
}, {
"commentId": 38730,
"cover": false,
"createTime": 1545143998000,
"disabled": false,
"height": 810,
"id": 102836,
"itemId": 300100,
"md5": "u/439687/8e130f48b769a4f0feb44a8af97c4e37",
"userId": 439687,
"userName": "文小刀",
"width": 1080
}],
"itemId": 300100,
"kuanXing": "",
"needShowAll": false,
"selected": true,
"shaidan": true,
"shaidanCouponVal": 147.00,
"shortContent": "双十一收的,喜欢!所有垫子拿掉可以做单人床,宽敞。颜色也低调洋气,家里有了色彩,但又自然的融合在一起,开心!",
"type": "item_comment",
"userName": "文小刀",
"userRole": "",
"userSelected": true
}, {
"canReply": true,
"comment": false,
"common": false,
"content": "真的超级喜欢,非常支持,质量非常好,与卖家描述的完全一致,非常满意,真的很喜欢,完全超出期望值,发货速度非常快,包装非常仔细、严实,物流公司服务态度很好,运送速度很快,很满意的一次购物",
"ctime": 1545658247000,
"groupId": 300100,
"id": 39273,
"itemCommentImgs": [{
"commentId": 39273,
"cover": false,
"createTime": 1545658247000,
"disabled": false,
"height": 1080,
"id": 104453,
"itemId": 300100,
"md5": "u/476996/afc3ea590d0d412af014f678d67e90b9",
"userId": 476996,
"userName": "白巧克力",
"width": 1080
}, {
"commentId": 39273,
"cover": true,
"createTime": 1545658247000,
"disabled": false,
"height": 1440,
"id": 104454,
"itemId": 300100,
"md5": "u/476996/afe0bc582b2d0b6253998fbe79d0fb3e",
"userId": 476996,
"userName": "白巧克力",
"width": 1080
}, {
"commentId": 39273,
"cover": false,
"createTime": 1545658247000,
"disabled": false,
"height": 1080,
"id": 104455,
"itemId": 300100,
"md5": "u/476996/38a1356d4993fb9c5144e2b8be55af80",
"userId": 476996,
"userName": "白巧克力",
"width": 1080
}],
"itemId": 300100,
"kuanXing": "脚墩",
"needShowAll": false,
"reply": "哇,好漂亮的家,简约温暖,从视觉上就已经让人心情舒畅,可以看出主人对生活的用心。也十分感谢您对造作的认可,我们会继续努力哒,也欢迎您常回来看看。",
"selected": true,
"shaidan": true,
"shaidanCouponVal": 107.00,
"shortContent": "真的超级喜欢,非常支持,质量非常好,与卖家描述的完全一致,非常满意,真的很喜欢,完全超出期望值,发货速度非常快,包装非常仔细、严实,物流公司服务态度很好,运送速度很快,很满意的一次购物",
"type": "item_comment",
"userImg": "d9b3dd984652620e9fb64ab4670e2614",
"userName": "白巧克力",
"userRole": "",
"userSelected": true
}, {
"canReply": true,
"comment": false,
"common": false,
"content": "造作给我一个大惊喜,原来购买沙发时就感觉质量面料摸不到,不知道会怎么样!但是当收到货时,超乎想象的好!无论做工,面料,版型我都超级喜欢!服务也好,有专业师傅上门安装!就这样被造作征服,以后会常来这里购物!",
"ctime": 1544585400000,
"groupId": 300100,
"id": 38237,
"itemCommentImgs": [{
"commentId": 38237,
"cover": false,
"createTime": 1544585400000,
"disabled": false,
"height": 864,
"id": 101358,
"itemId": 300100,
"md5": "u/604144/b6f90641363e8197a29c251a7b400099",
"userId": 604144,
"userName": "小五",
"width": 1152
}, {
"commentId": 38237,
"cover": false,
"createTime": 1544585400000,
"disabled": false,
"height": 864,
"id": 101359,
"itemId": 300100,
"md5": "u/604144/47453fd64ffb173ed5162bb17cf56ed8",
"userId": 604144,
"userName": "小五",
"width": 1152
}],
"itemId": 300100,
"kuanXing": "三人座",
"needShowAll": false,
"selected": true,
"shaidan": true,
"shaidanCouponVal": 480.00,
"shortContent": "造作给我一个大惊喜,原来购买沙发时就感觉质量面料摸不到,不知道会怎么样!但是当收到货时,超乎想象的好!无论做工,面料,版型我都超级喜欢!服务也好,有专业师傅上门安装!就这样被造作征服,以后会常来这里购物!",
"type": "item_comment",
"userImg": "474734fdfa6756d49ef0a5d7f1a02eba",
"userName": "小五",
"userRole": "",
"userSelected": true
}, {
"canReply": true,
"comment": false,
"common": false,
"content": "沙发简单大方,超级软,回头再买个其他颜色的沙发套,感谢送货师傅李士明!为了送货,晚饭都没吃。",
"ctime": 1544968633000,
"groupId": 300100,
"id": 38563,
"itemCommentImgs": [{
"commentId": 38563,
"cover": false,
"createTime": 1544968633000,
"disabled": false,
"height": 832,
"id": 102382,
"itemId": 300100,
"md5": "u/598445/436df0f43ec3fb923189a91953bc1400",
"userId": 598445,
"userName": "187****2865",
"width": 1080
}, {
"commentId": 38563,
"cover": true,
"createTime": 1544968633000,
"disabled": false,
"height": 810,
"id": 102383,
"itemId": 300100,
"md5": "u/598445/c2e4021e2aae4f254482d9837aa5b6e0",
"userId": 598445,
"userName": "187****2865",
"width": 1080
}, {
"commentId": 38563,
"cover": false,
"createTime": 1544968633000,
"disabled": false,
"height": 1440,
"id": 102384,
"itemId": 300100,
"md5": "u/598445/c61448414fbe08c82f8f15d4ae0459e7",
"userId": 598445,
"userName": "187****2865",
"width": 1080
}],
"itemId": 300100,
"kuanXing": "",
"needShowAll": false,
"reply": "看到最终沙发、茶几美美的摆在您的家里,并且您也很喜欢它们,我想我们送装师傅一定也是满满的成就感,即使没有吃上晚饭也会很幸福的。很开心您喜欢我们的产品,并对我们的服务感到满意,未来我们会继续努力哒。",
"selected": true,
"shaidan": true,
"shaidanCouponVal": 537.00,
"shortContent": "沙发简单大方,超级软,回头再买个其他颜色的沙发套,感谢送货师傅李士明!为了送货,晚饭都没吃。",
"type": "item_comment",
"userImg": "09f1534fc58ec21f2f1bebdb8ac9187c",
"userName": "小饭团",
"userRole": "",
"userSelected": true
}, {
"canReply": true,
"comment": false,
"common": false,
"content": "颜色很满意,和我家的墙面的颜色很搭。师傅很负责,搬运过程很小心。",
"ctime": 1544197724000,
"groupId": 300100,
"id": 37894,
"itemCommentImgs": [{
"commentId": 37894,
"cover": false,
"createTime": 1544197724000,
"disabled": false,
"height": 810,
"id": 100434,
"itemId": 300100,
"md5": "u/583719/72a72c5a996f308b3b34ba28373cc2a6",
"userId": 583719,
"userName": "Franky",
"width": 1080
}, {
"commentId": 37894,
"cover": false,
"createTime": 1544197724000,
"disabled": false,
"height": 1080,
"id": 100435,
"itemId": 300100,
"md5": "u/583719/dc3dd7c4a1ec0865c4a425100cea5d54",
"userId": 583719,
"userName": "Franky",
"width": 1080
}],
"itemId": 300100,
"kuanXing": "",
"needShowAll": false,
"selected": true,
"shaidan": true,
"shaidanCouponVal": 566.00,
"shortContent": "颜色很满意,和我家的墙面的颜色很搭。师傅很负责,搬运过程很小心。",
"type": "item_comment",
"userName": "Franky",
"userRole": "",
"userSelected": true
}, {
"canReply": true,
"comment": false,
"common": false,
"content": "雾蓝色沙发套颜色很稳重。跟灰色墙很配,因为无法展示就描述一下吧",
"ctime": 1544954179000,
"groupId": 300100,
"id": 38534,
"itemCommentImgs": [{
"commentId": 38534,
"cover": false,
"createTime": 1544954179000,
"disabled": false,
"height": 810,
"id": 102298,
"itemId": 300100,
"md5": "u/473600/a92aeaf549dfb992a6f4e88fc9e9d323",
"userId": 473600,
"userName": "米花麻麻",
"width": 1080
}, {
"commentId": 38534,
"cover": false,
"createTime": 1544954179000,
"disabled": false,
"height": 724,
"id": 102299,
"itemId": 300100,
"md5": "u/473600/efba1cb2247765e66f63f5ca61ef5222",
"userId": 473600,
"userName": "米花麻麻",
"width": 1080
}],
"itemId": 300100,
"kuanXing": "三人座",
"needShowAll": false,
"selected": true,
"shaidan": true,
"shaidanCouponVal": 97.00,
"shortContent": "雾蓝色沙发套颜色很稳重。跟灰色墙很配,因为无法展示就描述一下吧",
"type": "item_comment",
"userImg": "fc7ba9e2d48aedd7bf203668cce15e15",
"userName": "米花麻麻",
"userRole": "",
"userSelected": true
}, {
"canReply": true,
"comment": false,
"common": false,
"content": "终于收到满意的沙发啦,跟想象的几乎一致,颜色也正好,支持造作哈",
"ctime": 1544954034000,
"groupId": 300100,
"id": 38533,
"itemCommentImgs": [{
"commentId": 38533,
"cover": false,
"createTime": 1544954034000,
"disabled": false,
"height": 810,
"id": 102296,
"itemId": 300100,
"md5": "u/473600/c33367d673d75af001fa93a9d5167021",
"userId": 473600,
"userName": "米花麻麻",
"width": 1080
}, {
"commentId": 38533,
"cover": false,
"createTime": 1544954034000,
"disabled": false,
"height": 810,
"id": 102297,
"itemId": 300100,
"md5": "u/473600/a92aeaf549dfb992a6f4e88fc9e9d323",
"userId": 473600,
"userName": "米花麻麻",
"width": 1080
}]