diff options
-rw-r--r-- | packages/website/ts/components/fill_order.tsx | 12 | ||||
-rw-r--r-- | packages/website/ts/components/generate_order/generate_order_form.tsx | 5 | ||||
-rw-r--r-- | packages/website/ts/components/inputs/allowance_toggle.tsx | 8 | ||||
-rw-r--r-- | packages/website/ts/components/token_balances.tsx | 1 | ||||
-rw-r--r-- | yarn.lock | 16 |
5 files changed, 35 insertions, 7 deletions
diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx index 9da3006a0..97f616be2 100644 --- a/packages/website/ts/components/fill_order.tsx +++ b/packages/website/ts/components/fill_order.tsx @@ -561,6 +561,8 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { }); return; } + const networkName = constants.NETWORK_NAME_BY_ID[this.props.networkId]; + const eventLabel = `${parsedOrder.taker.token.symbol}-${networkName}`; try { const orderFilledAmount: BigNumber = await this.props.blockchain.fillOrderAsync( signedOrder, @@ -569,7 +571,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { ReactGA.event({ category: 'Portal', action: 'Fill Order Success', - label: parsedOrder.taker.token.symbol, + label: eventLabel, value: parsedOrder.taker.amount, }); // After fill completes, let's force fetch the token balances @@ -588,7 +590,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { ReactGA.event({ category: 'Portal', action: 'Fill Order Failure', - label: parsedOrder.taker.token.symbol, + label: eventLabel, value: parsedOrder.taker.amount, }); const errMsg = `${err}`; @@ -658,6 +660,8 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { }); return; } + const networkName = constants.NETWORK_NAME_BY_ID[this.props.networkId]; + const eventLabel = `${parsedOrder.maker.token.symbol}-${networkName}`; try { await this.props.blockchain.cancelOrderAsync(signedOrder, availableTakerTokenAmount); this.setState({ @@ -669,7 +673,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { ReactGA.event({ category: 'Portal', action: 'Cancel Order Success', - label: parsedOrder.maker.token.symbol, + label: eventLabel, value: parsedOrder.maker.amount, }); return; @@ -684,7 +688,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { ReactGA.event({ category: 'Portal', action: 'Cancel Order Failure', - label: parsedOrder.maker.token.symbol, + label: eventLabel, value: parsedOrder.maker.amount, }); globalErrMsg = 'Failed to cancel order, please refresh and try again'; diff --git a/packages/website/ts/components/generate_order/generate_order_form.tsx b/packages/website/ts/components/generate_order/generate_order_form.tsx index 2a62d4b9e..c9417f5a4 100644 --- a/packages/website/ts/components/generate_order/generate_order_form.tsx +++ b/packages/website/ts/components/generate_order/generate_order_form.tsx @@ -30,6 +30,7 @@ import { TokenByAddress, } from 'ts/types'; import { colors } from 'ts/utils/colors'; +import { constants } from 'ts/utils/constants'; import { errorReporter } from 'ts/utils/error_reporter'; import { utils } from 'ts/utils/utils'; @@ -262,10 +263,12 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G ) { const didSignSuccessfully = await this._signTransactionAsync(); if (didSignSuccessfully) { + const networkName = constants.NETWORK_NAME_BY_ID[this.props.networkId]; + const eventLabel = `${this.props.tokenByAddress[debitToken.address].symbol}-${networkName}`; ReactGA.event({ category: 'Portal', action: 'Sign Order Success', - label: this.props.tokenByAddress[debitToken.address].symbol, + label: eventLabel, value: debitToken.amount.toNumber(), }); this.setState({ diff --git a/packages/website/ts/components/inputs/allowance_toggle.tsx b/packages/website/ts/components/inputs/allowance_toggle.tsx index a737222ca..a2e75dfed 100644 --- a/packages/website/ts/components/inputs/allowance_toggle.tsx +++ b/packages/website/ts/components/inputs/allowance_toggle.tsx @@ -6,12 +6,14 @@ import * as ReactGA from 'react-ga'; import { Blockchain } from 'ts/blockchain'; import { Dispatcher } from 'ts/redux/dispatcher'; import { BalanceErrs, Token, TokenState } from 'ts/types'; +import { constants } from 'ts/utils/constants'; import { errorReporter } from 'ts/utils/error_reporter'; import { utils } from 'ts/utils/utils'; const DEFAULT_ALLOWANCE_AMOUNT_IN_BASE_UNITS = new BigNumber(2).pow(256).minus(1); interface AllowanceToggleProps { + networkId: number; blockchain: Blockchain; dispatcher: Dispatcher; onErrorOccurred: (errType: BalanceErrs) => void; @@ -74,12 +76,14 @@ export class AllowanceToggle extends React.Component<AllowanceToggleProps, Allow if (!this._isAllowanceSet()) { newAllowanceAmountInBaseUnits = DEFAULT_ALLOWANCE_AMOUNT_IN_BASE_UNITS; } + const networkName = constants.NETWORK_NAME_BY_ID[this.props.networkId]; + const eventLabel = `${this.props.token.symbol}-${networkName}`; try { await this.props.blockchain.setProxyAllowanceAsync(this.props.token, newAllowanceAmountInBaseUnits); ReactGA.event({ category: 'Portal', action: 'Set Allowance Success', - label: this.props.token.symbol, + label: eventLabel, value: newAllowanceAmountInBaseUnits.toNumber(), }); await this.props.refetchTokenStateAsync(); @@ -87,7 +91,7 @@ export class AllowanceToggle extends React.Component<AllowanceToggleProps, Allow ReactGA.event({ category: 'Portal', action: 'Set Allowance Failure', - label: this.props.token.symbol, + label: eventLabel, value: newAllowanceAmountInBaseUnits.toNumber(), }); this.setState({ diff --git a/packages/website/ts/components/token_balances.tsx b/packages/website/ts/components/token_balances.tsx index c6a9a46be..dfb62bbb3 100644 --- a/packages/website/ts/components/token_balances.tsx +++ b/packages/website/ts/components/token_balances.tsx @@ -392,6 +392,7 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala </TableRowColumn> <TableRowColumn> <AllowanceToggle + networkId={this.props.networkId} blockchain={this.props.blockchain} dispatcher={this.props.dispatcher} token={token} @@ -7272,6 +7272,13 @@ react-event-listener@^0.4.5: prop-types "^15.5.4" warning "^3.0.0" +react-ga@^2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-2.4.1.tgz#dfbd5f028ed39a07067f7a8bf57dc0d240000767" + optionalDependencies: + prop-types "^15.6.0" + react "^15.6.2 || ^16.0" + react-highlight@^0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/react-highlight/-/react-highlight-0.10.0.tgz#d386f9dceab867dc0dcc2364153fb1cc7645d046" @@ -7422,6 +7429,15 @@ react@^15.5.4: object-assign "^4.1.0" prop-types "^15.5.10" +"react@^15.6.2 || ^16.0": + version "16.2.0" + resolved "https://registry.yarnpkg.com/react/-/react-16.2.0.tgz#a31bd2dab89bff65d42134fa187f24d054c273ba" + dependencies: + fbjs "^0.8.16" + loose-envify "^1.1.0" + object-assign "^4.1.1" + prop-types "^15.6.0" + read-cmd-shim@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-1.0.1.tgz#2d5d157786a37c055d22077c32c53f8329e91c7b" |