Refactor Analytics so that calls to ReactGA are all in a single module, combining the provider type util function, moving GA id to configs and using utils.onPageLoadAsync
This commit is contained in:
@@ -3,12 +3,12 @@ import { BigNumber } from '@0xproject/utils';
|
||||
import * as _ from 'lodash';
|
||||
import Toggle from 'material-ui/Toggle';
|
||||
import * as React from 'react';
|
||||
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 { analytics } from 'ts/utils/analytics';
|
||||
import { utils } from 'ts/utils/utils';
|
||||
|
||||
const DEFAULT_ALLOWANCE_AMOUNT_IN_BASE_UNITS = new BigNumber(2).pow(256).minus(1);
|
||||
@@ -81,20 +81,10 @@ export class AllowanceToggle extends React.Component<AllowanceToggleProps, Allow
|
||||
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: eventLabel,
|
||||
value: newAllowanceAmountInBaseUnits.toNumber(),
|
||||
});
|
||||
analytics.logEvent('Portal', 'Set Allowance Success', eventLabel, newAllowanceAmountInBaseUnits.toNumber());
|
||||
await this.props.refetchTokenStateAsync();
|
||||
} catch (err) {
|
||||
ReactGA.event({
|
||||
category: 'Portal',
|
||||
action: 'Set Allowance Failure',
|
||||
label: eventLabel,
|
||||
value: newAllowanceAmountInBaseUnits.toNumber(),
|
||||
});
|
||||
analytics.logEvent('Portal', 'Set Allowance Failure', eventLabel, newAllowanceAmountInBaseUnits.toNumber());
|
||||
this.setState({
|
||||
isSpinnerVisible: false,
|
||||
});
|
||||
|
Reference in New Issue
Block a user