@ibmsoft/track-log
v1.1.0
Published
配合@ibmsoft/vue-track的统一话术
Downloads
1
Readme
日志埋点SDK统一话术上报格式
传入router实例
import { manualBuriedPoint, autoFormatLogs } from './dist/index.esm'
import router from './router'
export function reportTrack(trackInfo: TrackTemplateInfo) {
manualBuriedPoint(trackInfo, router, (pointInfo) => {
window.$vueDataAc.customClickAc({
entrance: pointInfo.entrance,
operation_content: pointInfo.eventLog,
operate_name: pointInfo.eventBehavior,
module_name: pointInfo.eventModule
})
})
}
传入router.to
import { reportTrack } from './track'
router.beforeEach((to, from, next) => {
if (token) {
// 自动上报菜单点击事件
reportTrack({}, to)
}
// ...
next()
})
处理自定义事件
import { reportTrack } from './track'
reportTrack({
eventModule: '我是自定义设置覆盖的模块',
eventAction: 'look',
eventLog: autoFormatLogs(['页码:1', '条数:10'])
})