SDK for web monitor, a simple web data collection tool for performance, exceptions, etc.
🏠 Homepage
npm install web-monitor-sdk
There is example
import dist/web-monitor-sdk.min.js
:
<script src="../../dist/web-monitor-sdk.min.js"></script>
and call init:
window.WebMonitorSDK.init({
debug: true,
sendError: false,
outtime:3000,
blacklistUrls:[
// 'localhost:8080/examples'
],
data:{
webUser:{
id:12345
}
}
},(data)=>{
fetch('http://demo/api',{
method:'POST',
headers: {'Content-Type': 'application/json'},
body:JSON.stringify(data)
})
});
There is example
// import * as webMonitor from 'web-monitor-sdk'
const webMonitor = require('web-monitor-sdk')
webMonitor.init({
debug:true,
sendError: false,
outtime:2000
},data=>{
fetch('http://demo/api',{
method:'POST',
headers: {'Content-Type': 'application/json'},
body:JSON.stringify(data)
})
})
WebMonitor.init(Options,fn)
Function
Callback function after data collection. We only collect data, not responsible for reporting data, so you need to assemble the logic of reporting data ourselves.
Enable debug funtionality such as Logger, in the SDK.
(Defaults to false)
Array<string | RegExp>
A pattern for URLs which should not be report. (By default, all urls will be sent)
number
Delay time to report, ensure the loading of asynchronous data. The unit is milliseconds. (Defaults to 1000)
boolean
Whether to report page performance data. (Defaults to true)
boolean
Whether to report error. (Defaults to true)
boolean
Whether to report unhandledrejection error in promise in Chrome 49+. (Defaults to true)
boolean
Whether to report unload error. (Defaults to true)
boolean
Whether to report client info such as user agent and resolution. (Defaults to true)
object
Additional data, to send to server together. (Default is undefined)
👤 Brizer <brizer@163.com>
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Give a ⭐️ if this project helped you!
Copyright © 2019 Brizer <brizer@163.com>.
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator