From 8b08a44820f0cbc327fae7c4c23a283d60872f22 Mon Sep 17 00:00:00 2001 From: enahum Date: Tue, 21 Nov 2017 13:01:42 -0300 Subject: [PATCH] RN-526 fix broken analytics (#1183) --- app/mattermost.js | 22 +++++++++++++++++++--- yarn.lock | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/mattermost.js b/app/mattermost.js index 92fa1e130..335705897 100644 --- a/app/mattermost.js +++ b/app/mattermost.js @@ -10,6 +10,7 @@ import {IntlProvider} from 'react-intl'; import { Alert, AppState, + Dimensions, InteractionManager, NativeModules, Platform @@ -151,12 +152,27 @@ export default class Mattermost { configureAnalytics = (config) => { if (config && config.DiagnosticsEnabled === 'true' && config.DiagnosticId && Config.SegmentApiKey) { if (!global.analytics) { + const {height, width} = Dimensions.get('window'); global.analytics = new Analytics(Config.SegmentApiKey); + global.analytics_context = { + app: { + version: DeviceInfo.getVersion(), + build: DeviceInfo.getBuildNumber() + }, + device: { + dimensions: { + height, + width + }, + isTablet: DeviceInfo.isTablet(), + os: DeviceInfo.getSystemVersion() + }, + server: config.Version + }; + global.analytics.identify({ userId: config.DiagnosticId, - context: { - ip: '0.0.0.0' - }, + context: global.analytics_context, page: { path: '', referrer: '', diff --git a/yarn.lock b/yarn.lock index 78832f171..e208cf385 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3961,7 +3961,7 @@ makeerror@1.0.x: mattermost-redux@mattermost/mattermost-redux#master: version "1.0.1" - resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/04f393e4ad512cd3be354f6ff57bb968bf3a27da" + resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/7c5c77c8fcf2b18530c7a5a07f229ee29a8f7822" dependencies: deep-equal "1.0.1" form-data "2.3.1"