Coder Social home page Coder Social logo

tracker's Introduction

tracker

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

使用方法如下 The usage is as follows

//接口上报
import Tracker from 'zmy-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 DefaultOptons {
    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: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})

tracker's People

Contributors

message163 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.