1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 09:23:21 +01:00

add version dimension to metrics event (#8419)

* add version dimension to metrics event

* mock global.platform.getVersion

Co-authored-by: Erik Marks <rekmarks@protonmail.com>
This commit is contained in:
Jenny Pollack 2020-05-05 06:40:36 -07:00 committed by GitHub
parent fda4c94670
commit e00982aa58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 2 deletions

View File

@ -62,6 +62,11 @@ function updateQueryParams (newView) {
// MetaMask Controller
//
// some extension platform APIs must be mocked
function mockPlatformApis () {
global.platform.getVersion = () => '0.0.0'
}
const controller = new MetamaskController({
// User confirmation callbacks:
showUnconfirmedMessage: noop,
@ -72,6 +77,7 @@ const controller = new MetamaskController({
})
global.metamaskController = controller
global.platform = new ExtensionPlatform()
mockPlatformApis()
//
// User Interface

View File

@ -39,6 +39,7 @@ All metrics events send the following data when called:
- accountType
- numberOfTokens
- numberOfAccounts
- version
These are added to the metrics event via the metametrics provider.

View File

@ -32,6 +32,7 @@ class MetaMetricsProvider extends Component {
numberOfTokens: PropTypes.number,
numberOfAccounts: PropTypes.number,
participateInMetaMetrics: PropTypes.bool,
version: PropTypes.string,
}
static childContextTypes = {
@ -66,6 +67,7 @@ class MetaMetricsProvider extends Component {
metaMetricsSendCount,
numberOfTokens,
numberOfAccounts,
version,
} = this.props
const { previousPath, currentPath } = this.state
@ -86,6 +88,7 @@ class MetaMetricsProvider extends Component {
metaMetricsId,
numberOfTokens,
numberOfAccounts,
version,
...config,
previousPath,
currentPath,
@ -116,6 +119,7 @@ const mapStateToProps = (state) => {
metaMetricsSendCount: state.metamask.metaMetricsSendCount,
numberOfTokens: getNumberOfTokens(state),
numberOfAccounts: getNumberOfAccounts(state),
version: global.platform.getVersion(),
}
}

View File

@ -13,7 +13,7 @@ const METAMETRICS_TRACKING_URL = inDevelopment
: 'http://www.metamask.io/metametrics-prod'
/** ***************Custom variables*************** **/
// Custon variable declarations
// Custom variable declarations
const METAMETRICS_CUSTOM_GAS_LIMIT_CHANGE = 'gasLimitChange'
const METAMETRICS_CUSTOM_GAS_PRICE_CHANGE = 'gasPriceChange'
const METAMETRICS_CUSTOM_FUNCTION_TYPE = 'functionType'
@ -55,7 +55,7 @@ const METAMETRICS_CUSTOM_ACTIVE_CURRENCY = 'activeCurrency'
const METAMETRICS_CUSTOM_ACCOUNT_TYPE = 'accountType'
const METAMETRICS_CUSTOM_NUMBER_OF_TOKENS = 'numberOfTokens'
const METAMETRICS_CUSTOM_NUMBER_OF_ACCOUNTS = 'numberOfAccounts'
const METAMETRICS_CUSTOM_VERSION = 'version'
const customDimensionsNameIdMap = {
[METAMETRICS_CUSTOM_NETWORK]: 5,
@ -64,6 +64,7 @@ const customDimensionsNameIdMap = {
[METAMETRICS_CUSTOM_ACCOUNT_TYPE]: 8,
[METAMETRICS_CUSTOM_NUMBER_OF_TOKENS]: 9,
[METAMETRICS_CUSTOM_NUMBER_OF_ACCOUNTS]: 10,
[METAMETRICS_CUSTOM_VERSION]: 11,
}
function composeUrlRefParamAddition (previousPath, confirmTransactionOrigin) {
@ -130,6 +131,7 @@ function composeUrl (config) {
accountType,
numberOfTokens,
numberOfAccounts,
version,
previousPath = '',
currentPath,
metaMetricsId,
@ -156,6 +158,7 @@ function composeUrl (config) {
environmentType,
activeCurrency,
accountType,
version,
numberOfTokens: (customVariables && customVariables.numberOfTokens) || numberOfTokens,
numberOfAccounts: (customVariables && customVariables.numberOfAccounts) || numberOfAccounts,
}) : ''