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
This commit is contained in:
Damien Lespiau
2017-09-25 13:55:38 +01:00
parent 3f6faa5371
commit a205f6ecb7
19 changed files with 44 additions and 44 deletions

View File

@@ -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'),

View File

@@ -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'),

View File

@@ -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

View File

@@ -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'),

View File

@@ -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();

View File

@@ -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'),

View File

@@ -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() {

View File

@@ -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(

View File

@@ -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(

View File

@@ -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() {

View File

@@ -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,
});

View File

@@ -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'),

View File

@@ -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();
}
}

View File

@@ -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() {

View File

@@ -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'),

View File

@@ -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'),
});

View File

@@ -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,

View File

@@ -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'),

View File

@@ -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);
}
}