1.0.2 • Published 1 year ago

jc-tracker v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

tracker

这是一个埋点SDK This is a buried SDK

使用方法如下 The usage is as follows

//接口上报
import Tracker from 'jc-tracker'
const tr = new Tracker({
    requestUrl:"xxxxxx"
})

options 介绍 Options introduction

/**
 * @requestUrl 接口地址
 * @historyTracker history上报
 * @hashTracker hash上报
 * @domTracker 携带Tracker-key 点击事件上报
 * @historyTracker sdkVersion sdk版本
 * @historyTracker extra 透传字段
 * @jsError js 和 promise 报错异常上报
 */
export interface DefaultOptions {
    uuid: string | undefined,
    requestUrl: string | undefined,
    historyTracker: boolean,
    hashTracker: boolean,
    domTracker: boolean,
    sdkVersion: string | number,
    extra: Record<string, any> | undefined,
    jsError:boolean
}

Dom上报 DOM escalation

//  <button target-key="埋点值">按钮</button>
//只要有target-key 就会自动上报
const tr = new Tracker({
    requestUrl:"http://localhost:9527/xxxx", //接口地址
    domTracker:true
})

用法 usage

const tr = new Tracker({
    requestUrl:"http://localhost:9527/xxxx", //接口地址
    historyTracker:true,
    domTracker:true,
    jsError:true,
})
//添加用户id
tr.setUuid()
//自定义上报 必须要有 event 和 targetKey  两个字段
tr.sendTracker({xxx})
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago