analytics user UUID

This commit is contained in:
Eugene Pankov 2018-10-25 17:32:51 +02:00
parent 9f35ab1a66
commit 822e068bb5
3 changed files with 11 additions and 1 deletions

View File

@ -3,6 +3,7 @@ import { Injectable } from '@angular/core'
import { ElectronService } from './electron.service'
import { ConfigService } from './config.service'
import ua = require('universal-analytics')
import uuidv4 = require('uuid/v4')
@Injectable()
export class HomeBaseService {
@ -37,7 +38,10 @@ export class HomeBaseService {
}
enableAnalytics () {
const session = ua('UA-3278102-20')
if (!window.localStorage.analyticsUserID) {
window.localStorage.analyticsUserID = uuidv4()
}
const session = ua('UA-3278102-20', window.localStorage.analyticsUserID)
session.set('cd1', this.appVersion)
session.set('cd2', process.platform)
session.pageview('/').send()

View File

@ -25,6 +25,7 @@
"deep-equal": "1.0.1",
"file-loader": "^0.11.2",
"rage-edit-tmp": "^1.1.0",
"uuid": "^3.3.2",
"xterm": "^3.6.0"
},
"peerDependencies": {

View File

@ -168,6 +168,11 @@ thenify-all@^1.0.0:
dependencies:
any-promise "^1.0.0"
uuid@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==
xterm@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.6.0.tgz#9b95cd23a338e5842343aec1a104f094c5153e7c"