@ibmsoft/track-log
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

日志埋点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'])
 })

Readme

Keywords

none

Package Sidebar

Install

npm i @ibmsoft/track-log

Weekly Downloads

0

Version

1.1.0

License

ISC

Unpacked Size

15.5 kB

Total Files

8

Last publish

Collaborators

  • hankin.dream