From a205f6ecb75c0ee1f0f254b98f5276ff9e6ecd7c Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Mon, 25 Sep 2017 13:55:38 +0100 Subject: [PATCH] tracking: Rename trackMixpanelEvent() to trackAnalyticsEvent() Might as well not mention Mixpanel now that we're sending all events to Segment. Commit done with: git grep trackMixpanelEvent | cut -d : -f 1 | sort -u | \ xargs sed -e s/trackMixpanelEvent/trackAnalyticsEvent/g --- client/app/scripts/charts/node.js | 4 ++-- client/app/scripts/charts/nodes-grid.js | 4 ++-- client/app/scripts/charts/nodes-layout.js | 4 ++-- client/app/scripts/components/app.js | 4 ++-- client/app/scripts/components/footer.js | 4 ++-- client/app/scripts/components/metric-selector-item.js | 4 ++-- .../node-details/node-details-health-link-item.js | 4 ++-- .../node-details/node-details-relatives-link.js | 4 ++-- .../node-details/node-details-table-node-link.js | 4 ++-- .../node-details-table-node-metric-link.js | 4 ++-- .../nodes-resources/node-resources-metric-box.js | 4 ++-- client/app/scripts/components/search.js | 6 +++--- client/app/scripts/components/time-control.js | 10 +++++----- client/app/scripts/components/time-travel-timeline.js | 4 ++-- client/app/scripts/components/time-travel.js | 8 ++++---- client/app/scripts/components/topologies.js | 4 ++-- client/app/scripts/components/topology-options.js | 4 ++-- client/app/scripts/components/view-mode-selector.js | 4 ++-- client/app/scripts/utils/tracking-utils.js | 4 ++-- 19 files changed, 44 insertions(+), 44 deletions(-) diff --git a/client/app/scripts/charts/node.js b/client/app/scripts/charts/node.js index 0b5cfb868..b18664585 100644 --- a/client/app/scripts/charts/node.js +++ b/client/app/scripts/charts/node.js @@ -7,7 +7,7 @@ import { clickNode, enterNode, leaveNode } from '../actions/app-actions'; import { getNodeColor } from '../utils/color-utils'; import MatchedText from '../components/matched-text'; import MatchedResults from '../components/matched-results'; -import { trackMixpanelEvent } from '../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../utils/tracking-utils'; import { GRAPH_VIEW_MODE } from '../constants/naming'; import { NODE_BASE_SIZE } from '../constants/styles'; @@ -149,7 +149,7 @@ class Node extends React.Component { handleMouseClick(ev) { ev.stopPropagation(); - trackMixpanelEvent('scope.node.click', { + trackAnalyticsEvent('scope.node.click', { layout: GRAPH_VIEW_MODE, topologyId: this.props.currentTopology.get('id'), parentTopologyId: this.props.currentTopology.get('parentId'), diff --git a/client/app/scripts/charts/nodes-grid.js b/client/app/scripts/charts/nodes-grid.js index dee2b08bd..aae3abf3f 100644 --- a/client/app/scripts/charts/nodes-grid.js +++ b/client/app/scripts/charts/nodes-grid.js @@ -6,7 +6,7 @@ import { List as makeList, Map as makeMap } from 'immutable'; import NodeDetailsTable from '../components/node-details/node-details-table'; import { clickNode, sortOrderChanged } from '../actions/app-actions'; import { shownNodesSelector } from '../selectors/node-filters'; -import { trackMixpanelEvent } from '../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../utils/tracking-utils'; import { TABLE_VIEW_MODE } from '../constants/naming'; import { canvasMarginsSelector, canvasHeightSelector } from '../selectors/canvas'; @@ -88,7 +88,7 @@ class NodesGrid extends React.Component { } onClickRow(ev, node) { - trackMixpanelEvent('scope.node.click', { + trackAnalyticsEvent('scope.node.click', { layout: TABLE_VIEW_MODE, topologyId: this.props.currentTopology.get('id'), parentTopologyId: this.props.currentTopology.get('parentId'), diff --git a/client/app/scripts/charts/nodes-layout.js b/client/app/scripts/charts/nodes-layout.js index 34db4c5d0..6c2c725e0 100644 --- a/client/app/scripts/charts/nodes-layout.js +++ b/client/app/scripts/charts/nodes-layout.js @@ -5,7 +5,7 @@ import pick from 'lodash/pick'; import { NODE_BASE_SIZE, EDGE_WAYPOINTS_CAP } from '../constants/styles'; import { EDGE_ID_SEPARATOR } from '../constants/naming'; -import { trackMixpanelEvent } from '../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../utils/tracking-utils'; import { featureIsEnabledAny } from '../utils/feature-utils'; import { buildTopologyCacheId, updateNodeDegrees } from '../utils/topology-utils'; import { minEuclideanDistanceBetweenPoints } from '../utils/math-utils'; @@ -483,7 +483,7 @@ export function doLayout(immNodes, immEdges, opts) { // Last line of defense - re-render everything if two nodes are too close to one another. if (minEuclideanDistanceBetweenPoints(layout.nodes) < NODE_CENTERS_SEPARATION_FACTOR) { layout = runLayoutEngine(cache.graph, nodesWithDegrees, immEdges, opts); - trackMixpanelEvent('scope.layout.graph.overlap'); + trackAnalyticsEvent('scope.layout.graph.overlap'); } // cache results diff --git a/client/app/scripts/components/app.js b/client/app/scripts/components/app.js index 5adc44bc4..eda6590c7 100644 --- a/client/app/scripts/components/app.js +++ b/client/app/scripts/components/app.js @@ -38,7 +38,7 @@ import ViewModeSelector from './view-mode-selector'; import NetworkSelector from './networks-selector'; import DebugToolbar, { showingDebugToolbar, toggleDebugToolbar } from './debug-toolbar'; import { getRouter, getUrlState } from '../utils/router-utils'; -import { trackMixpanelEvent } from '../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../utils/tracking-utils'; import { availableNetworksSelector } from '../selectors/node-networks'; import { isResourceViewModeSelector, @@ -147,7 +147,7 @@ class App extends React.Component { } trackEvent(eventName, additionalProps = {}) { - trackMixpanelEvent(eventName, { + trackAnalyticsEvent(eventName, { layout: this.props.topologyViewMode, topologyId: this.props.currentTopology.get('id'), parentTopologyId: this.props.currentTopology.get('parentId'), diff --git a/client/app/scripts/components/footer.js b/client/app/scripts/components/footer.js index d84ce9582..82cbf9a3a 100644 --- a/client/app/scripts/components/footer.js +++ b/client/app/scripts/components/footer.js @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import Plugins from './plugins'; -import { trackMixpanelEvent } from '../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../utils/tracking-utils'; import { clickDownloadGraph, clickForceRelayout, @@ -27,7 +27,7 @@ class Footer extends React.Component { handleRelayoutClick(ev) { ev.preventDefault(); - trackMixpanelEvent('scope.layout.refresh.click', { + trackAnalyticsEvent('scope.layout.refresh.click', { layout: this.props.topologyViewMode, }); this.props.clickForceRelayout(); diff --git a/client/app/scripts/components/metric-selector-item.js b/client/app/scripts/components/metric-selector-item.js index fda5bbce2..de51f9018 100644 --- a/client/app/scripts/components/metric-selector-item.js +++ b/client/app/scripts/components/metric-selector-item.js @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { hoverMetric, pinMetric, unpinMetric } from '../actions/app-actions'; import { selectedMetricTypeSelector } from '../selectors/node-metric'; -import { trackMixpanelEvent } from '../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../utils/tracking-utils'; class MetricSelectorItem extends React.Component { @@ -16,7 +16,7 @@ class MetricSelectorItem extends React.Component { } trackEvent(eventName) { - trackMixpanelEvent(eventName, { + trackAnalyticsEvent(eventName, { metricType: this.props.metric.get('label'), layout: this.props.topologyViewMode, topologyId: this.props.currentTopology.get('id'), diff --git a/client/app/scripts/components/node-details/node-details-health-link-item.js b/client/app/scripts/components/node-details/node-details-health-link-item.js index f9084390c..45a45b4fd 100644 --- a/client/app/scripts/components/node-details/node-details-health-link-item.js +++ b/client/app/scripts/components/node-details/node-details-health-link-item.js @@ -5,7 +5,7 @@ import NodeDetailsHealthItem from './node-details-health-item'; import CloudLink from '../cloud-link'; import { getMetricColor } from '../../utils/metric-utils'; import { darkenColor } from '../../utils/color-utils'; -import { trackMixpanelEvent } from '../../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../../utils/tracking-utils'; /** * @param {string} url @@ -59,7 +59,7 @@ class NodeDetailsHealthLinkItem extends React.Component { } onClick() { - trackMixpanelEvent('scope.node.metric.click', { topologyId: this.props.topologyId }); + trackAnalyticsEvent('scope.node.metric.click', { topologyId: this.props.topologyId }); } render() { diff --git a/client/app/scripts/components/node-details/node-details-relatives-link.js b/client/app/scripts/components/node-details/node-details-relatives-link.js index f7c0daa91..251063767 100644 --- a/client/app/scripts/components/node-details/node-details-relatives-link.js +++ b/client/app/scripts/components/node-details/node-details-relatives-link.js @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { clickRelative } from '../../actions/app-actions'; -import { trackMixpanelEvent } from '../../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../../utils/tracking-utils'; import MatchedText from '../matched-text'; @@ -16,7 +16,7 @@ class NodeDetailsRelativesLink extends React.Component { handleClick(ev) { ev.preventDefault(); - trackMixpanelEvent('scope.node.relative.click', { + trackAnalyticsEvent('scope.node.relative.click', { topologyId: this.props.topologyId, }); this.props.dispatch(clickRelative( diff --git a/client/app/scripts/components/node-details/node-details-table-node-link.js b/client/app/scripts/components/node-details/node-details-table-node-link.js index bd77b9f3a..1ba3cec15 100644 --- a/client/app/scripts/components/node-details/node-details-table-node-link.js +++ b/client/app/scripts/components/node-details/node-details-table-node-link.js @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { clickRelative } from '../../actions/app-actions'; -import { trackMixpanelEvent } from '../../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../../utils/tracking-utils'; import { dismissRowClickProps } from './node-details-table-row'; @@ -16,7 +16,7 @@ class NodeDetailsTableNodeLink extends React.Component { handleClick(ev) { ev.preventDefault(); - trackMixpanelEvent('scope.node.relative.click', { + trackAnalyticsEvent('scope.node.relative.click', { topologyId: this.props.topologyId, }); this.props.dispatch(clickRelative( diff --git a/client/app/scripts/components/node-details/node-details-table-node-metric-link.js b/client/app/scripts/components/node-details/node-details-table-node-metric-link.js index db5090604..2b6251867 100644 --- a/client/app/scripts/components/node-details/node-details-table-node-metric-link.js +++ b/client/app/scripts/components/node-details/node-details-table-node-metric-link.js @@ -2,7 +2,7 @@ import React from 'react'; import CloudLink from '../cloud-link'; import { formatMetric } from '../../utils/string-utils'; -import { trackMixpanelEvent } from '../../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../../utils/tracking-utils'; import { dismissRowClickProps } from './node-details-table-row'; class NodeDetailsTableNodeMetricLink extends React.Component { @@ -13,7 +13,7 @@ class NodeDetailsTableNodeMetricLink extends React.Component { } onClick() { - trackMixpanelEvent('scope.node.metric.click', { topologyId: this.props.topologyId }); + trackAnalyticsEvent('scope.node.metric.click', { topologyId: this.props.topologyId }); } render() { diff --git a/client/app/scripts/components/nodes-resources/node-resources-metric-box.js b/client/app/scripts/components/nodes-resources/node-resources-metric-box.js index 499deb842..fa48632db 100644 --- a/client/app/scripts/components/nodes-resources/node-resources-metric-box.js +++ b/client/app/scripts/components/nodes-resources/node-resources-metric-box.js @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import NodeResourcesMetricBoxInfo from './node-resources-metric-box-info'; import { clickNode } from '../../actions/app-actions'; -import { trackMixpanelEvent } from '../../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../../utils/tracking-utils'; import { applyTransform } from '../../utils/transform-utils'; import { RESOURCE_VIEW_MODE } from '../../constants/naming'; import { @@ -62,7 +62,7 @@ class NodeResourcesMetricBox extends React.Component { handleClick(ev) { ev.stopPropagation(); - trackMixpanelEvent('scope.node.click', { + trackAnalyticsEvent('scope.node.click', { layout: RESOURCE_VIEW_MODE, topologyId: this.props.topologyId, }); diff --git a/client/app/scripts/components/search.js b/client/app/scripts/components/search.js index f769d199b..d46468055 100644 --- a/client/app/scripts/components/search.js +++ b/client/app/scripts/components/search.js @@ -9,7 +9,7 @@ import { isResourceViewModeSelector } from '../selectors/topology'; import { slugify } from '../utils/string-utils'; import { parseQuery } from '../utils/search-utils'; import { isTopologyNodeCountZero } from '../utils/topology-utils'; -import { trackMixpanelEvent } from '../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../utils/tracking-utils'; import SearchItem from './search-item'; import { ENTER_KEY_CODE } from '../constants/key-codes'; @@ -82,7 +82,7 @@ class Search extends React.Component { handleKeyUp(ev) { // If the search query is parsable, pin it when ENTER key is hit. if (ev.keyCode === ENTER_KEY_CODE && parseQuery(this.props.searchQuery)) { - trackMixpanelEvent('scope.search.query.pin', { + trackAnalyticsEvent('scope.search.query.pin', { layout: this.props.topologyViewMode, topologyId: this.props.currentTopology.get('id'), parentTopologyId: this.props.currentTopology.get('parentId'), @@ -97,7 +97,7 @@ class Search extends React.Component { doSearch(value) { if (value !== '') { - trackMixpanelEvent('scope.search.query.change', { + trackAnalyticsEvent('scope.search.query.change', { layout: this.props.topologyViewMode, topologyId: this.props.currentTopology.get('id'), parentTopologyId: this.props.currentTopology.get('parentId'), diff --git a/client/app/scripts/components/time-control.js b/client/app/scripts/components/time-control.js index ed63562c5..8c231182d 100644 --- a/client/app/scripts/components/time-control.js +++ b/client/app/scripts/components/time-control.js @@ -3,7 +3,7 @@ import moment from 'moment'; import classNames from 'classnames'; import { connect } from 'react-redux'; -import { trackMixpanelEvent } from '../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../utils/tracking-utils'; import { pauseTimeAtNow, resumeTime, startTimeTravel } from '../actions/app-actions'; import { TIMELINE_TICK_INTERVAL } from '../constants/timer'; @@ -43,21 +43,21 @@ class TimeControl extends React.Component { } handleNowClick() { - trackMixpanelEvent('scope.time.resume.click', this.getTrackingMetadata()); + trackAnalyticsEvent('scope.time.resume.click', this.getTrackingMetadata()); this.props.resumeTime(); } handlePauseClick() { - trackMixpanelEvent('scope.time.pause.click', this.getTrackingMetadata()); + trackAnalyticsEvent('scope.time.pause.click', this.getTrackingMetadata()); this.props.pauseTimeAtNow(); } handleTravelClick() { if (!this.props.showingTimeTravel) { - trackMixpanelEvent('scope.time.travel.click', this.getTrackingMetadata({ open: true })); + trackAnalyticsEvent('scope.time.travel.click', this.getTrackingMetadata({ open: true })); this.props.startTimeTravel(); } else { - trackMixpanelEvent('scope.time.travel.click', this.getTrackingMetadata({ open: false })); + trackAnalyticsEvent('scope.time.travel.click', this.getTrackingMetadata({ open: false })); this.props.resumeTime(); } } diff --git a/client/app/scripts/components/time-travel-timeline.js b/client/app/scripts/components/time-travel-timeline.js index c8abe83a5..d859351ed 100644 --- a/client/app/scripts/components/time-travel-timeline.js +++ b/client/app/scripts/components/time-travel-timeline.js @@ -11,7 +11,7 @@ import { Motion } from 'react-motion'; import { zoomFactor } from '../utils/zoom-utils'; import { strongSpring } from '../utils/animation-utils'; import { linearGradientValue } from '../utils/math-utils'; -import { trackMixpanelEvent } from '../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../utils/tracking-utils'; import { nowInSecondsPrecision, clampToNowInSecondsPrecision, @@ -147,7 +147,7 @@ class TimeTravelTimeline extends React.Component { const periods = ['years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds']; const duration = scaleDuration(this.state.durationPerPixel, MAX_TICK_SPACING_PX); const zoomedPeriod = find(periods, period => Math.floor(duration.get(period)) && period); - trackMixpanelEvent('scope.time.timeline.zoom', { zoomedPeriod }); + trackAnalyticsEvent('scope.time.timeline.zoom', { zoomedPeriod }); } handlePanStart() { diff --git a/client/app/scripts/components/time-travel.js b/client/app/scripts/components/time-travel.js index 1a94acb40..79528bb2a 100644 --- a/client/app/scripts/components/time-travel.js +++ b/client/app/scripts/components/time-travel.js @@ -5,7 +5,7 @@ import { connect } from 'react-redux'; import { debounce } from 'lodash'; import TimeTravelTimeline from './time-travel-timeline'; -import { trackMixpanelEvent } from '../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../utils/tracking-utils'; import { clampToNowInSecondsPrecision } from '../utils/time-utils'; import { jumpToTime, @@ -83,7 +83,7 @@ class TimeTravel extends React.Component { } trackTimestampEdit() { - trackMixpanelEvent('scope.time.timestamp.edit', { + trackAnalyticsEvent('scope.time.timestamp.edit', { layout: this.props.topologyViewMode, topologyId: this.props.currentTopology.get('id'), parentTopologyId: this.props.currentTopology.get('parentId'), @@ -91,7 +91,7 @@ class TimeTravel extends React.Component { } trackTimelineClick() { - trackMixpanelEvent('scope.time.timeline.click', { + trackAnalyticsEvent('scope.time.timeline.click', { layout: this.props.topologyViewMode, topologyId: this.props.currentTopology.get('id'), parentTopologyId: this.props.currentTopology.get('parentId'), @@ -99,7 +99,7 @@ class TimeTravel extends React.Component { } trackTimelinePan() { - trackMixpanelEvent('scope.time.timeline.pan', { + trackAnalyticsEvent('scope.time.timeline.pan', { layout: this.props.topologyViewMode, topologyId: this.props.currentTopology.get('id'), parentTopologyId: this.props.currentTopology.get('parentId'), diff --git a/client/app/scripts/components/topologies.js b/client/app/scripts/components/topologies.js index 880141b68..0d89befda 100644 --- a/client/app/scripts/components/topologies.js +++ b/client/app/scripts/components/topologies.js @@ -2,7 +2,7 @@ import React from 'react'; import { connect } from 'react-redux'; import classnames from 'classnames'; -import { trackMixpanelEvent } from '../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../utils/tracking-utils'; import { searchMatchCountByTopologySelector } from '../selectors/search'; import { isResourceViewModeSelector } from '../selectors/topology'; import { clickTopology } from '../actions/app-actions'; @@ -28,7 +28,7 @@ class Topologies extends React.Component { onTopologyClick(ev, topology) { ev.preventDefault(); - trackMixpanelEvent('scope.topology.selector.click', { + trackAnalyticsEvent('scope.topology.selector.click', { topologyId: topology.get('id'), parentTopologyId: topology.get('parentId'), }); diff --git a/client/app/scripts/components/topology-options.js b/client/app/scripts/components/topology-options.js index 9a8cc7b4f..68fe1549b 100644 --- a/client/app/scripts/components/topology-options.js +++ b/client/app/scripts/components/topology-options.js @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import { Set as makeSet, Map as makeMap } from 'immutable'; import includes from 'lodash/includes'; -import { trackMixpanelEvent } from '../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../utils/tracking-utils'; import { getCurrentTopologyOptions } from '../utils/topology-utils'; import { activeTopologyOptionsSelector } from '../selectors/topology'; import TopologyOptionAction from './topology-option-action'; @@ -19,7 +19,7 @@ class TopologyOptions extends React.Component { } trackOptionClick(optionId, nextOptions) { - trackMixpanelEvent('scope.topology.option.click', { + trackAnalyticsEvent('scope.topology.option.click', { optionId, value: nextOptions, layout: this.props.topologyViewMode, diff --git a/client/app/scripts/components/view-mode-selector.js b/client/app/scripts/components/view-mode-selector.js index ba447b3c7..a4a351afd 100644 --- a/client/app/scripts/components/view-mode-selector.js +++ b/client/app/scripts/components/view-mode-selector.js @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import classNames from 'classnames'; import MetricSelector from './metric-selector'; -import { trackMixpanelEvent } from '../utils/tracking-utils'; +import { trackAnalyticsEvent } from '../utils/tracking-utils'; import { setGraphView, setTableView, setResourceView } from '../actions/app-actions'; import { availableMetricsSelector } from '../selectors/node-metric'; import { @@ -30,7 +30,7 @@ class ViewModeSelector extends React.Component { 'view-mode-selector-action-selected': isSelected, }); const onClick = () => { - trackMixpanelEvent('scope.layout.selector.click', { + trackAnalyticsEvent('scope.layout.selector.click', { layout: viewMode, topologyId: this.props.currentTopology.get('id'), parentTopologyId: this.props.currentTopology.get('parentId'), diff --git a/client/app/scripts/utils/tracking-utils.js b/client/app/scripts/utils/tracking-utils.js index ff3813149..30b1342d8 100644 --- a/client/app/scripts/utils/tracking-utils.js +++ b/client/app/scripts/utils/tracking-utils.js @@ -3,10 +3,10 @@ import debug from 'debug'; const log = debug('service:tracking'); // Track mixpanel events only if Scope is running inside of Weave Cloud. -export function trackMixpanelEvent(name, props) { +export function trackAnalyticsEvent(name, props) { if (window.analytics && process.env.WEAVE_CLOUD) { window.analytics.track(name, props); } else { - log('trackMixpanelEvent', name, props); + log('trackAnalyticsEvent', name, props); } }