From fed9c86abb979916a0bfbb137c41bf302c0db81a Mon Sep 17 00:00:00 2001 From: ryanml Date: Mon, 21 Jun 2021 12:02:51 -0700 Subject: [PATCH] Adding gasEstimateType to 'Changed Gas Button' metrics event (#11352) Adding 'Changed Gas Button' metrics event --- .../send-gas-row/send-gas-row.component.js | 25 ++++++++----------- .../send-gas-row.component.test.js | 2 +- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/ui/pages/send/send-content/send-gas-row/send-gas-row.component.js b/ui/pages/send/send-content/send-gas-row/send-gas-row.component.js index 9cbe21629..0ee7a6030 100644 --- a/ui/pages/send/send-content/send-gas-row/send-gas-row.component.js +++ b/ui/pages/send/send-content/send-gas-row/send-gas-row.component.js @@ -32,11 +32,11 @@ export default class SendGasRow extends Component { static contextTypes = { t: PropTypes.func, - metricsEvent: PropTypes.func, + trackEvent: PropTypes.func, }; renderAdvancedOptionsButton() { - const { metricsEvent } = this.context; + const { trackEvent } = this.context; const { showCustomizeGasModal, isMainnet, @@ -54,12 +54,9 @@ export default class SendGasRow extends Component {
{ - metricsEvent({ - eventOpts: { - category: 'Transactions', - action: 'Edit Screen', - name: 'Clicked "Advanced Options"', - }, + trackEvent({ + category: 'Transactions', + event: 'Clicked "Advanced Options"', }); showCustomizeGasModal(); }} @@ -105,7 +102,7 @@ export default class SendGasRow extends Component { isEthGasPrice, noGasPrice, } = this.props; - const { metricsEvent } = this.context; + const { trackEvent } = this.context; const gasPriceFetchFailure = isEthGasPrice || noGasPrice; const gasPriceButtonGroup = ( @@ -115,11 +112,11 @@ export default class SendGasRow extends Component { showCheck={false} {...gasPriceButtonGroupProps} handleGasPriceSelection={async (opts) => { - metricsEvent({ - eventOpts: { - category: 'Transactions', - action: 'Edit Screen', - name: 'Changed Gas Button', + trackEvent({ + category: 'Transactions', + event: 'User Clicked Gas Estimate Button', + properties: { + gasEstimateType: opts.gasEstimateType.toLowerCase(), }, }); await gasPriceButtonGroupProps.handleGasPriceSelection(opts); diff --git a/ui/pages/send/send-content/send-gas-row/send-gas-row.component.test.js b/ui/pages/send/send-content/send-gas-row/send-gas-row.component.test.js index b6382f5bf..7f4505558 100644 --- a/ui/pages/send/send-content/send-gas-row/send-gas-row.component.test.js +++ b/ui/pages/send/send-content/send-gas-row/send-gas-row.component.test.js @@ -32,7 +32,7 @@ describe('SendGasRow Component', () => { anotherGasPriceButtonGroupProp: 'bar', }} />, - { context: { t: (str) => `${str}_t`, metricsEvent: () => ({}) } }, + { context: { t: (str) => `${str}_t`, trackEvent: () => ({}) } }, ); wrapper.setProps({ isMainnet: true }); });