rq-track
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

rq-tracker

埋点SDK

已实现

自定义指令事件上报监听

首屏加载数据监听

路由变化监听

获取配置数据

请求类型为application/json

//接口上报
import Tracker from 'rq-tracker'

const tr = new Tracker({
    requestUrl:"xxxxxx"
})

options 介绍 Options introduction

/**
 * @requestUrl 接口地址
 * @historyTracker history上报
 * @hashTracker hash上报
 * @domTracker 携带Tracker-key 点击事件上报
 * @aboveTracker 获取首屏数据
 * @historyTracker sdkVersion sdk版本
 * @historyTracker extra 透传字段
 * @jsError js 和 promise 报错异常上报
 */
export interface DefaultOptons {
    uuid: string | undefined,
    requestUrl: string | undefined,
    historyTracker: boolean,
    hashTracker: boolean,
    domTracker: boolean,
    aboveTracker: 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:3000/xxxx", //接口地址
    domTracker:true
})

用法 usage

const tr = new Tracker({
    requestUrl:"http://localhost:3000/xxxx", //接口地址
    historyTracker:true,
    domTracker:true,
    jsError:true,
})
//添加用户id
tr.setUserId()

//自定义上报 必须要有 event 和 targetKey  两个字段
tr.sendTracker({xxx})

Readme

Keywords

Package Sidebar

Install

npm i rq-track

Weekly Downloads

1

Version

1.1.1

License

ISC

Unpacked Size

24.8 kB

Total Files

6

Last publish

Collaborators

  • zhengdaonian