From 97cc0a0d73dcacfefcdff785c802762e2a0a60d6 Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Fri, 24 Feb 2017 17:34:21 +0000 Subject: PLT-5071: Client side component of Telemetry. (#5516) --- webapp/components/root.jsx | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'webapp/components/root.jsx') diff --git a/webapp/components/root.jsx b/webapp/components/root.jsx index 465df5d79..4e7c19452 100644 --- a/webapp/components/root.jsx +++ b/webapp/components/root.jsx @@ -14,6 +14,7 @@ import $ from 'jquery'; import {browserHistory} from 'react-router/es6'; import UserStore from 'stores/user_store.jsx'; import BrowserStore from 'stores/browser_store.jsx'; +import Constants from 'utils/constants.jsx'; export default class Root extends React.Component { constructor(props) { @@ -26,12 +27,26 @@ export default class Root extends React.Component { this.localizationChanged = this.localizationChanged.bind(this); this.redirectIfNecessary = this.redirectIfNecessary.bind(this); + const segmentKey = Constants.DIAGNOSTICS_SEGMENT_KEY; + // Ya.... /*eslint-disable */ - if (window.mm_config.SegmentDeveloperKey != null && window.mm_config.SegmentDeveloperKey !== "") { + if (segmentKey != null && segmentKey !== '' && window.mm_config.DiagnosticsEnabled) { !function(){var analytics=global.window.analytics=global.window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","group","track","ready","alias","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t