Authored by 沈志敏

新增H5页面分享成功埋点

... ... @@ -22,6 +22,30 @@ let shareData = {
imgUrl: 'http://static.yohobuy.com/m/v1/img/touch/apple-touch-icon-144x144-precomposed-new.png'
};
const getShareData = function(shareType) {
let data = {
success: function() {
window._yas.sendCustomInfo && window._yas.sendCustomInfo({
op: 'YB_SHARE_SUCCESS_L',
param: JSON.stringify({
SHARE_TYPE: shareType,
SHARE_URL: location.href
})
}, true);
}
};
return Object.assign(data, shareData);
};
const setShareData = function() {
window.wx.onMenuShareAppMessage(getShareData('1'));
window.wx.onMenuShareTimeline(getShareData('2'));
window.wx.onMenuShareWeibo(getShareData('3'));
window.wx.onMenuShareQQ(getShareData('4'));
window.wx.onMenuShareQZone(getShareData('5'));
};
if (/QQ/i.test(navigator.userAgent)) {
$.ajax({
url: '//qzonestyle.gtimg.cn/qzone/qzact/common/share/share.js',
... ... @@ -60,11 +84,7 @@ if (/MicroMessenger/i.test(navigator.userAgent)) {
jsApiList: jsApiList
});
window.wx.ready(function() {
window.wx.onMenuShareAppMessage(shareData);
window.wx.onMenuShareTimeline(shareData);
window.wx.onMenuShareQQ(shareData);
window.wx.onMenuShareWeibo(shareData);
window.wx.onMenuShareQZone(shareData);
setShareData();
});
}
}
... ... @@ -95,11 +115,7 @@ module.exports = function(data) {
shareData = data;
if (window.wx) {
window.wx.onMenuShareAppMessage(shareData);
window.wx.onMenuShareTimeline(shareData);
window.wx.onMenuShareQQ(shareData);
window.wx.onMenuShareWeibo(shareData);
window.wx.onMenuShareQZone(shareData);
setShareData();
}
window.setShareInfo && window.setShareInfo({
... ...