1.0.1 • Published 4 years ago
social-error-tracking v1.0.1
social-error-tracking lib
This lib comes with error tracking configuration:
- the most busy hours - from 2AM until 4AM
- during two hours after deploy time
- filters number of users
Installation :rocket:
npm i social-error-tracking --save
or list it as a dependency in a package.json file:
{
"devDependencies": {
"social-error-tracking": "social-error-tracking"
}
}
Initialization:
import ErrorTracking from 'social-error-tracking'
export default {
...
data() {
return {
DEPLOY_TIME,
trackingData: {
id: '123', // user id
email: 'useremail@email.com',
// this variable should be listed as an undefined in the component where errorTracking is initialized
timestamp: this.DEPLOY_TIME,
project: 'project name',
name: 'user name',
// percentage from all events to being tracked
trackingPercentage: 8,
}
}
}
// as an example you may initialize tracking depending on your needs
created() {
ErrorTracking.init(this.trackingData)
},
...
}
Initialisation of DEPLOY_TIME variable :stopwatch: :
In your vue.config.js file:
module.exports = {
chainWebpack: config => config.plugin('define-plugin').use(
webpack.DefinePlugin,
[{ DEPLOY_TIME: new Date().getTime() }],
)
}
Track exceptions :
try {
localStorage.setItem('item', 'name')
} catch (e) {
ErrorTracking.exception(e)
}