PLT-5071: Client side component of Telemetry. (#5516)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f182d196ff
Коммит
97cc0a0d73
@@ -4,6 +4,7 @@
|
||||
import Client from './client.jsx';
|
||||
|
||||
import TeamStore from 'stores/team_store.jsx';
|
||||
import UserStore from 'stores/user_store.jsx';
|
||||
import BrowserStore from 'stores/browser_store.jsx';
|
||||
|
||||
import * as GlobalActions from 'actions/global_actions.jsx';
|
||||
@@ -29,16 +30,22 @@ class WebClientClass extends Client {
|
||||
onTeamStoreChanged() {
|
||||
this.setTeamId(TeamStore.getCurrentId());
|
||||
}
|
||||
|
||||
track(category, action, label, property, value) {
|
||||
trackEvent(category, event, props) {
|
||||
if (global.window && global.window.analytics) {
|
||||
global.window.analytics.track(action, {category, label, property, value});
|
||||
}
|
||||
}
|
||||
|
||||
trackPage() {
|
||||
if (global.window && global.window.analytics) {
|
||||
global.window.analytics.page();
|
||||
const properties = Object.assign({category, type: event, user_id: UserStore.getCurrentId()}, props);
|
||||
const options = {
|
||||
context: {
|
||||
ip: '0.0.0.0'
|
||||
},
|
||||
page: {
|
||||
path: '',
|
||||
referrer: '',
|
||||
search: '',
|
||||
title: '',
|
||||
url: ''
|
||||
}
|
||||
};
|
||||
global.window.analytics.track('event', properties, options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +81,7 @@ class WebClientClass extends Client {
|
||||
password,
|
||||
token,
|
||||
(data) => {
|
||||
this.track('api', 'api_users_login_success', '', 'login_id', loginId);
|
||||
this.trackEvent('api', 'api_users_login_success');
|
||||
BrowserStore.signalLogin();
|
||||
|
||||
if (success) {
|
||||
@@ -82,7 +89,7 @@ class WebClientClass extends Client {
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
this.track('api', 'api_users_login_fail', '', 'login_id', loginId);
|
||||
this.trackEvent('api', 'api_users_login_fail');
|
||||
if (error) {
|
||||
error(err);
|
||||
}
|
||||
@@ -96,7 +103,8 @@ class WebClientClass extends Client {
|
||||
password,
|
||||
token,
|
||||
(data) => {
|
||||
this.track('api', 'api_users_login_success', '', 'login_id', loginId);
|
||||
this.trackEvent('api', 'api_users_login_success');
|
||||
this.trackEvent('api', 'api_users_login_ldap_success');
|
||||
BrowserStore.signalLogin();
|
||||
|
||||
if (success) {
|
||||
@@ -104,7 +112,8 @@ class WebClientClass extends Client {
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
this.track('api', 'api_users_login_fail', '', 'login_id', loginId);
|
||||
this.trackEvent('api', 'api_users_login_fail');
|
||||
this.trackEvent('api', 'api_users_login_ldap_fail');
|
||||
if (error) {
|
||||
error(err);
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user