1.1.4 • Published 2 years ago

ab-tracker v1.1.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

ab-tracker

自动埋点用于在前台的鼠标事件,error和promise抛出异常,history和hashchange的上传统计数据 1. history和hash路由的改变进行上报 2. js监听error事件上报 3. promise的reject错误上报 4. 提供可配置选项

install

  npm install ab-tracker

es模块使用

  import abTracker from 'ab-tarcker'
  const Bpoint = new abTracker({reqUrl:"http:localhost:9000/tracker",version:'v1.0.0',extra:{msg:'额外字段'},historyPlugin:true,hashPlugin:true,domPlugin:true,errorPlugin:true})
  // 自定义dom上报
  const Bpoint = new abTracker({uuid:'xxxxxxx191919',reqUrl:"http:localhost:9000/tracker",version:'v1.0.0',extra:{msg:'额外字段'},historyPlugin:true,hashPlugin:true,domPlugin:{is:true,options:['click'],dataKey:'tracker-key'},errorPlugin:true})

  // 使用暴露的接口手动触发上传
  Bpoint.setDataKey({event:Event,targetKey:string,[key:string]:any}})
  // 使用暴露的接口手动触设置额外字段
  Bpoint.setExtra({})
  // 使用暴露的接口自定义uuid
  Bpoint.setUserId('xxxxxxx191919')

cjs模块使用

  const  abTracker = require('ab-tarcker')
  const Bpoint = new abTracker({reqUrl:"http:localhost:9000/tracker",version:'v1.0.0',extra:{msg:'额外字段'},historyPlugin:true,hashPlugin:true,domPlugin:true,errorPlugin:true})
  // 自定义dom上报
  const Bpoint = new abTracker({uuid:'xxxxxxx191919',reqUrl:"http:localhost:9000/tracker",version:'v1.0.0',extra:{msg:'额外字段'},historyPlugin:true,hashPlugin:true,domPlugin:{is:true,options:['click'],dataKey:'tracker-key'},errorPlugin:true})

  // 使用暴露的接口手动触发上传
  Bpoint.setDataKey({event:Event,targetKey:string,[key:string]:any}})
  // 使用暴露的接口手动触设置额外字段
  Bpoint.setExtra({})
  // 使用暴露的接口自定义uuid
  Bpoint.setUserId('xxxxxxx191919')

cdn加载

<div>
  <h1>自动埋点</h1>
  <button tracker-key="鼠标事件上报">鼠标移到我上面点击试试</button>
</div>
<script>

const abTracker = new Bpoint({uuid:'xxxxxxx191919',reqUrl:"http:localhost:9000/tracker",version:'v1.0.0',extra:{msg:'额外字段'},historyPlugin:true,hashPlugin:true,domPlugin:{is:true,options:['click'],dataKey:'tracker-key'},errorPlugin:true})

</script>
1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.0.0

2 years ago