Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Limoer96/tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tracker

一款无痕埋点工具

运行Demo

  1. clone 到本地
  2. yarn install 安装依赖
  3. yarn serve 运行demo
  4. 访问localhost:3000并打开控制台Network查看收集信息及上报

使用

  1. clone到本地并安装依赖
  2. yarn build 构建文件
  3. 通过script标签在入口html中引入
  4. 在入口html中添加script标签并添加以下代码:
window.onload = function() {
  new Tracker({ uploadUrl: 'your upload url', events: ['click'] })
    .regist()
}

配置项

 interface IConfig {
  events?: string[] // 监听的事件 默认值:['click']
  uploadType?: string // 上传的方式 默认值:‘immedite’ 暂不支持其它方式
  uploadUrl: string // 数据上报接口,必填
  mode?: string // 模式 暂无使用
}

TodoList

  • uploadTypeunload,页面关闭之前批量上传数据
  • mode选择埋点收集数据的模式,可以选择是否收集额外数据
  • event支持,目前确认可用的只有click
  • 多浏览器兼容性