[Open-source] Front-end monitoring SDK, highlights support for locating source code, playing back recordings, and recording user behavior

Open SourceProcess Management
2026-06-28 02:59 3 次浏览 • 0 次下载 0KB
[Open-source] Front-end monitoring SDK, highlights support for locating source code, playing back recordings, and recording user behavior

1. Project Overview

A self-developed front-end monitoring SDK, can be used to collect and report: code error, performance data, user behavior, loading resources, personalized indicators, etc. data

Highlights: support multiple error recovery methods: locate source code, play recording, record user behavior

2. Open Source License

Author has not specified open source protocol

3. Screenshots

Demonstration

Background page

Demonstration effect

4. Feature Overview

Function

  • [√] ✈️ Error capture: code error, resource loading error, interface request error
  • [√] ✈️ Performance data: FP, FCP, LCP, CLS, TTFB, FID
  • [√] ✈️ User behavior: page click, route jump, interface call, resource loading
  • [√] ✈️ Personalized indicators: Long Task, Memory page memory, first screen loading time
  • [√] Manual report error
  • [√] Support multiple configurations: custom hook and options
  • [√] Supported Web frameworks: vue2, vue3, React

5. Tech Stack

Installation

$ npm i web-see

Vue

import webSee from 'web-see';

Vue.use(webSee, {
  dsn: 'http://localhost:8083/reportData', // Report address
  apikey: 'project1', // Project unique id
  userId: '89757', // User id
  silentRecordScreen: true // Enable recording
});

React

import webSee from 'web-see';

webSee.init({
  dsn: 'http://localhost:8083/reportData',
  apikey: 'project1',
  userId: '89757'
});

Configuration Item

Name

Type

Default

Description

dsn

string

""

(Required item) Report interface address, post method

apikey

string

""

(Required item) Each project corresponds to an apikey, unique identifier

userId

string

""

User id

disabled

boolean

false

Default is enabled state, true will disable the sdk

useImgUpload

boolean

false

True will use image dotting report method, parameters through data=encodeURIComponent(reportData) concatenated to url, default is false

throttleDelayTime

number

0

Default will collect click to label, this parameter can set button click throttle time

overTime

number

10

Set interface timeout duration, default 10s

maxBreadcrumbs

number

20

User behavior storage maximum capacity, exceeding 20, earliest record will be covered

recordScreentime

number

10

Single recording duration, silentRecordScreen set to true, this setting is only valid when recording

silentXhr

boolean

false

Default will monitor xhr, true will not monitor

silentFetch

boolean

false

Default will monitor fetch, true will not monitor

silentClick

boolean

false

Default will listen click event, when user click label is not body will be put into breadcrumb, true will not listen

silentHistory

boolean

false

Will monitor popstate, pushState, replaceState by default, and will not monitor when true.

silentError

boolean

false

Will monitor error by default, and will not monitor when true.

silentUnhandledrejection

boolean

false

Will monitor unhandledrejection by default, and will not monitor when true.

silentHashchange

boolean

false

Will monitor hashchange by default, and will not monitor when true.

silentPerformance

boolean

false

Will report performance metrics by default, and will not report when true.

silentRecordScreen

boolean

false

Note: Will not enable screen recording by default, and will enable when true.

filterXhrUrlRegExp

regExp

null

Will be empty by default, and all interface requests will be monitored, and will filter when not empty and filterXhrUrlRegExp.test(xhr.url) is true.

beforePushBreadcrumb

function

null

(Custom hook) The hook added to the behavior list before, has a value when true, and all user behaviors will go through this hook for processing, and will not add to the list if returns false.

beforeDataReport

function

null

(Custom hook) The hook before data reporting, has a value when true, and all reporting data will go through this hook for processing, and will not report if returns false.

Custom hook example

beforePushBreadcrumb

// Add user behavior
push(data) {
  if (typeof this.beforePushBreadcrumb === 'function') {
    /**
      * Execute user-defined hook, and will not add to the list if returns false,
      * @param { object } this The current user behavior instance
      * @param { object } data The data to be added to the user behavior list
      */
    let result = this.beforePushBreadcrumb(this, data);
    if (!result) return;
    this.immediatePush(result);
    return;
  }
  this.immediatePush(data);
}

beforeDataReport

// Hook before data reporting
async beforePost(data) {
  let transportData = this.getTransportData(data);
  /**
  * Execute user-defined hook, and will not report if returns false,
  * @param { object } transportData The data to be reported
  */
  if (typeof this.beforeDataReport === 'function') {
    transportData = this.beforeDataReport(transportData);
    if (!transportData) return false;
  }
  return transportData;
}

Manual error reporting example

import webSee from 'web-see';

webSee.log({
  type: 'custom',
  message: 'Manual error information',
  error: new Error('Error')
});
#1
资源直链https://github.com/xy-sea/web-see/archive/refs/heads/main.zip
去下载
星河码客

发现和分享优质开源项目,传承互联网精神,为开发者服务。

关于本站

联系我们

微信/广告合作:ITcloub (备注星河码客)

免责声明:本站资源版权归原作者所有,仅供学习与交流。如有侵权,请通过「关于我们 - 侵权投诉」联系删除。

Powered by Nuxt · Deployed on Cloudflare