Add `version` dimension to background metrics (#9167)

The background metrics were missing the `version` custom dimension. It
has now been added to all background metric events.
feature/default_network_editable
Mark Stacey 4 years ago committed by GitHub
parent 3a7097a4cf
commit c557e25ba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/scripts/lib/background-metametrics.js
  2. 9
      app/scripts/metamask-controller.js
  3. 1
      ui/app/helpers/utils/metametrics.util.js

@ -1,7 +1,7 @@
import { getBackgroundMetaMetricState } from '../../../ui/app/selectors' import { getBackgroundMetaMetricState } from '../../../ui/app/selectors'
import { sendMetaMetricsEvent } from '../../../ui/app/helpers/utils/metametrics.util' import { sendMetaMetricsEvent } from '../../../ui/app/helpers/utils/metametrics.util'
export default function backgroundMetaMetricsEvent (metaMaskState, eventData) { export default function backgroundMetaMetricsEvent (metaMaskState, version, eventData) {
eventData.eventOpts['category'] = 'Background' eventData.eventOpts['category'] = 'Background'
@ -10,6 +10,7 @@ export default function backgroundMetaMetricsEvent (metaMaskState, eventData) {
sendMetaMetricsEvent({ sendMetaMetricsEvent({
...stateEventData, ...stateEventData,
...eventData, ...eventData,
version,
currentPath: '/background', currentPath: '/background',
}) })
} }

@ -1842,13 +1842,18 @@ export default class MetamaskController extends EventEmitter {
} }
const metamaskState = await this.getState() const metamaskState = await this.getState()
backgroundMetaMetricsEvent(metamaskState, { const version = this.platform.getVersion()
backgroundMetaMetricsEvent(
metamaskState,
version,
{
customVariables, customVariables,
eventOpts: { eventOpts: {
action, action,
name, name,
}, },
}) },
)
} }
//============================================================================= //=============================================================================

@ -115,6 +115,7 @@ function composeParamAddition (paramValue, paramName) {
* @property {string} config.accountType The account type being used at the time of the event: 'hardware', 'imported' or 'default' * @property {string} config.accountType The account type being used at the time of the event: 'hardware', 'imported' or 'default'
* @property {number} config.numberOfTokens The number of tokens that the user has added at the time of the event * @property {number} config.numberOfTokens The number of tokens that the user has added at the time of the event
* @property {number} config.numberOfAccounts The number of accounts the user has added at the time of the event * @property {number} config.numberOfAccounts The number of accounts the user has added at the time of the event
* @property {string} config.version The current version of the MetaMask extension
* @property {string} config.previousPath The pathname of the URL the user was on prior to the URL they are on at the time of the event * @property {string} config.previousPath The pathname of the URL the user was on prior to the URL they are on at the time of the event
* @property {string} config.currentPath The pathname of the URL the user is on at the time of the event * @property {string} config.currentPath The pathname of the URL the user is on at the time of the event
* @property {string} config.metaMetricsId A random id assigned to a user at the time of opting in to metametrics. A hexadecimal number * @property {string} config.metaMetricsId A random id assigned to a user at the time of opting in to metametrics. A hexadecimal number

Loading…
Cancel
Save