feat: telemetry client module
This commit is contained in:
27
client/js/modules/telemetry.js
Normal file
27
client/js/modules/telemetry.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import uuid from 'uuid/v4'
|
||||
|
||||
/* global CONSTANTS, wiki */
|
||||
|
||||
export default {
|
||||
cid: '',
|
||||
init() {
|
||||
this.cid = uuid()
|
||||
},
|
||||
sendEvent() {
|
||||
wiki.$http.post(CONSTANTS.TELEMETRY.GA_REMOTE, {
|
||||
v: 1, // API version
|
||||
tid: CONSTANTS.TELEMETRY.GA_ID, // Tracking ID
|
||||
aip: 1, // Anonymize IP
|
||||
ds: 'server', // Data source
|
||||
t: 'event', // Hit Type
|
||||
ec: 'setup', // Event Category
|
||||
ea: 'start', // Event Action
|
||||
el: 'success', // Event Label
|
||||
ev: 1 // Event Value
|
||||
}).then(resp => {
|
||||
|
||||
}, err => {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user