PLT-5071: Client side component of Telemetry. (#5516)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f182d196ff
Коммит
97cc0a0d73
@@ -1,12 +0,0 @@
|
||||
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import Client from 'client/web_client.jsx';
|
||||
|
||||
export function track(category, action, label, property, value) {
|
||||
Client.track(category, action, label, property, value);
|
||||
}
|
||||
|
||||
export function trackPage() {
|
||||
Client.trackPage();
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import * as ChannelUtils from 'utils/channel_utils.jsx';
|
||||
import PreferenceStore from 'stores/preference_store.jsx';
|
||||
|
||||
import {loadProfilesAndTeamMembersForDMSidebar} from 'actions/user_actions.jsx';
|
||||
import {trackEvent} from 'actions/diagnostics_actions.jsx';
|
||||
|
||||
import Client from 'client/web_client.jsx';
|
||||
import * as AsyncClient from 'utils/async_client.jsx';
|
||||
@@ -171,6 +172,7 @@ export function openDirectChannelToUser(user, success, error) {
|
||||
const channel = ChannelStore.getByName(channelName);
|
||||
|
||||
if (channel) {
|
||||
trackEvent('api', 'api_channels_join_direct');
|
||||
PreferenceStore.setPreference(Preferences.CATEGORY_DIRECT_CHANNEL_SHOW, user.id, 'true');
|
||||
loadProfilesAndTeamMembersForDMSidebar();
|
||||
|
||||
@@ -224,10 +226,12 @@ export function openDirectChannelToUser(user, success, error) {
|
||||
}
|
||||
|
||||
export function markFavorite(channelId) {
|
||||
trackEvent('api', 'api_channels_favorited');
|
||||
AsyncClient.savePreference(Preferences.CATEGORY_FAVORITE_CHANNEL, channelId, 'true');
|
||||
}
|
||||
|
||||
export function unmarkFavorite(channelId) {
|
||||
trackEvent('api', 'api_channels_unfavorited');
|
||||
const pref = {
|
||||
user_id: UserStore.getCurrentId(),
|
||||
category: Preferences.CATEGORY_FAVORITE_CHANNEL,
|
||||
|
||||
8
webapp/actions/diagnostics_actions.jsx
Обычный файл
8
webapp/actions/diagnostics_actions.jsx
Обычный файл
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import Client from 'client/web_client.jsx';
|
||||
|
||||
export function trackEvent(category, event, properties) {
|
||||
Client.trackEvent(category, event, properties);
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import {loadProfilesAndTeamMembersForDMSidebar} from 'actions/user_actions.jsx';
|
||||
import {loadChannelsForCurrentUser} from 'actions/channel_actions.jsx';
|
||||
import {stopPeriodicStatusUpdates} from 'actions/status_actions.jsx';
|
||||
import * as WebsocketActions from 'actions/websocket_actions.jsx';
|
||||
import {trackEvent} from 'actions/diagnostics_actions.jsx';
|
||||
|
||||
import Constants from 'utils/constants.jsx';
|
||||
const ActionTypes = Constants.ActionTypes;
|
||||
@@ -28,7 +29,6 @@ import * as Utils from 'utils/utils.jsx';
|
||||
|
||||
import en from 'i18n/en.json';
|
||||
import * as I18n from 'i18n/i18n.jsx';
|
||||
import {trackPage} from 'actions/analytics_actions.jsx';
|
||||
import {browserHistory} from 'react-router/es6';
|
||||
|
||||
export function emitChannelClickEvent(channel) {
|
||||
@@ -53,7 +53,6 @@ export function emitChannelClickEvent(channel) {
|
||||
AsyncClient.getChannelStats(chan.id, true);
|
||||
AsyncClient.viewChannel(chan.id, oldChannelId);
|
||||
loadPosts(chan.id);
|
||||
trackPage();
|
||||
});
|
||||
|
||||
// Mark previous and next channel as read
|
||||
@@ -94,6 +93,10 @@ export function emitInitialLoad(callback) {
|
||||
global.window.mm_config = data.client_cfg;
|
||||
global.window.mm_license = data.license_cfg;
|
||||
|
||||
if (global.window && global.window.analytics) {
|
||||
global.window.analytics.identify(global.window.mm_config.DiagnosticId);
|
||||
}
|
||||
|
||||
UserStore.setNoAccounts(data.no_accounts);
|
||||
|
||||
if (data.user && data.user.id) {
|
||||
@@ -515,6 +518,8 @@ export function emitSearchMentionsEvent(user) {
|
||||
terms = termKeys.join(' ');
|
||||
}
|
||||
|
||||
trackEvent('api', 'api_posts_search_mention');
|
||||
|
||||
AppDispatcher.handleServerAction({
|
||||
type: ActionTypes.RECEIVED_SEARCH_TERM,
|
||||
term: terms,
|
||||
|
||||
@@ -9,6 +9,7 @@ import UserStore from 'stores/user_store.jsx';
|
||||
|
||||
import {loadStatusesForChannel} from 'actions/status_actions.jsx';
|
||||
import {loadNewDMIfNeeded} from 'actions/user_actions.jsx';
|
||||
import {trackEvent} from 'actions/diagnostics_actions.jsx';
|
||||
|
||||
import Client from 'client/web_client.jsx';
|
||||
import * as AsyncClient from 'utils/async_client.jsx';
|
||||
@@ -64,10 +65,12 @@ export function handleNewPost(post, msg) {
|
||||
}
|
||||
|
||||
export function flagPost(postId) {
|
||||
trackEvent('api', 'api_posts_flagged');
|
||||
AsyncClient.savePreference(Preferences.CATEGORY_FLAGGED_POST, postId, 'true');
|
||||
}
|
||||
|
||||
export function unflagPost(postId, success) {
|
||||
trackEvent('api', 'api_posts_unflagged');
|
||||
const pref = {
|
||||
user_id: UserStore.getCurrentId(),
|
||||
category: Preferences.CATEGORY_FLAGGED_POST,
|
||||
|
||||
Ссылка в новой задаче
Block a user