diff options
12 files changed, 24 insertions, 5 deletions
diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx index 25d21c3dd..e4838bc0f 100644 --- a/packages/website/ts/components/fill_order.tsx +++ b/packages/website/ts/components/fill_order.tsx @@ -508,6 +508,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { } private _trackOrderEvent(eventName: string): void { const parsedOrder = this.state.parsedOrder; + // tslint:disable-next-line:no-floating-promises analytics.trackOrderEventAsync(eventName, parsedOrder); } private async _onFillOrderClickFireAndForgetAsync(): Promise<void> { diff --git a/packages/website/ts/components/forms/subscribe_form.tsx b/packages/website/ts/components/forms/subscribe_form.tsx index 19abbdf5f..be0468b6f 100644 --- a/packages/website/ts/components/forms/subscribe_form.tsx +++ b/packages/website/ts/components/forms/subscribe_form.tsx @@ -114,6 +114,7 @@ export class SubscribeForm extends React.Component<SubscribeFormProps, Subscribe const response = await backendClient.subscribeToNewsletterAsync(this.state.emailText); const status = response.status === 200 ? SubscribeFormStatus.Success : SubscribeFormStatus.Error; if (status === SubscribeFormStatus.Success) { + // tslint:disable-next-line:no-floating-promises analytics.indentifyAsync(this.state.emailText, 'email'); } this.setState({ status, emailText: '' }); 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 691abd4aa..524960aa7 100644 --- a/packages/website/ts/components/generate_order/generate_order_form.tsx +++ b/packages/website/ts/components/generate_order/generate_order_form.tsx @@ -268,6 +268,7 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G const signedOrder = await this._signTransactionAsync(); const doesSignedOrderExist = !_.isUndefined(signedOrder); if (doesSignedOrderExist) { + // tslint:disable-next-line:no-floating-promises analytics.trackOrderEventAsync('Sign Order Success', signedOrder); this.setState({ globalErrMsg: '', @@ -281,6 +282,7 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G globalErrMsg = 'You must enable wallet communication'; this.props.dispatcher.updateShouldBlockchainErrDialogBeOpen(true); } + // tslint:disable-next-line:no-floating-promises analytics.trackAsync('Sign Order Failure', { makerTokenAmount: debitToken.amount.toString(), makerToken: this.props.tokenByAddress[debitToken.address].symbol, diff --git a/packages/website/ts/components/inputs/allowance_toggle.tsx b/packages/website/ts/components/inputs/allowance_toggle.tsx index 8e9d4fe8d..6f4ffa320 100644 --- a/packages/website/ts/components/inputs/allowance_toggle.tsx +++ b/packages/website/ts/components/inputs/allowance_toggle.tsx @@ -117,9 +117,11 @@ export class AllowanceToggle extends React.Component<AllowanceToggleProps, Allow }; try { await this.props.blockchain.setProxyAllowanceAsync(this.props.token, newAllowanceAmountInBaseUnits); + // tslint:disable-next-line:no-floating-promises analytics.trackAsync('Set Allowances Success', logData); await this.props.refetchTokenStateAsync(); } catch (err) { + // tslint:disable-next-line:no-floating-promises analytics.trackAsync('Set Allowance Failure', logData); this.setState({ isSpinnerVisible: false, diff --git a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx index 516fdac3c..e051d86d9 100644 --- a/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx +++ b/packages/website/ts/components/onboarding/portal_onboarding_flow.tsx @@ -224,6 +224,7 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp (this.props.stepIndex === 0 && !this.props.isRunning && this.props.blockchainIsLoaded) || (!this.props.isRunning && !this.props.hasBeenClosed && this.props.blockchainIsLoaded) ) { + // tslint:disable-next-line:no-floating-promises analytics.trackAsync('Onboarding Started', { reason: 'automatic', stepIndex: this.props.stepIndex, @@ -236,6 +237,7 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp } private _closeOnboarding(): void { this.props.updateIsRunning(false); + // tslint:disable-next-line:no-floating-promises analytics.trackAsync('OnboardingClosed', { stepIndex: this.props.stepIndex, }); diff --git a/packages/website/ts/components/portal/portal.tsx b/packages/website/ts/components/portal/portal.tsx index f5ac3b6f3..fbaa419d8 100644 --- a/packages/website/ts/components/portal/portal.tsx +++ b/packages/website/ts/components/portal/portal.tsx @@ -389,6 +389,7 @@ export class Portal extends React.Component<PortalProps, PortalState> { ); } private _startOnboarding(): void { + // tslint:disable-next-line:no-floating-promises analytics.trackAsync('Onboarding Started', { reason: 'manual', stepIndex: this.props.portalOnboardingStep, diff --git a/packages/website/ts/components/relayer_index/relayer_grid_tile.tsx b/packages/website/ts/components/relayer_index/relayer_grid_tile.tsx index 937f0b79d..475b79f8f 100644 --- a/packages/website/ts/components/relayer_index/relayer_grid_tile.tsx +++ b/packages/website/ts/components/relayer_index/relayer_grid_tile.tsx @@ -65,6 +65,7 @@ export const RelayerGridTile: React.StatelessComponent<RelayerGridTileProps> = ( const topTokens = props.relayerInfo.topTokens; const weeklyTxnVolume = props.relayerInfo.weeklyTxnVolume; const onClick = () => { + // tslint:disable-next-line:no-floating-promises analytics.trackAsync('Relayer Click', { name: props.relayerInfo.name, }); diff --git a/packages/website/ts/components/relayer_index/relayer_top_tokens.tsx b/packages/website/ts/components/relayer_index/relayer_top_tokens.tsx index e6e0095c2..33783b406 100644 --- a/packages/website/ts/components/relayer_index/relayer_top_tokens.tsx +++ b/packages/website/ts/components/relayer_index/relayer_top_tokens.tsx @@ -1,8 +1,4 @@ -import { - colors, - EtherscanLinkSuffixes, - utils as sharedUtils, -} from '@0xproject/react-shared'; +import { colors, EtherscanLinkSuffixes, utils as sharedUtils } from '@0xproject/react-shared'; import * as _ from 'lodash'; import * as React from 'react'; @@ -47,6 +43,7 @@ class TokenLink extends React.Component<TokenLinkProps, TokenLinkState> { public render(): React.ReactNode { const onClick = (event: React.MouseEvent<HTMLElement>) => { event.stopPropagation(); + // tslint:disable-next-line:no-floating-promises analytics.trackAsync('Token Click', { tokenSymbol: this.props.tokenInfo.symbol, }); diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx index 2fdcded38..8523b819a 100644 --- a/packages/website/ts/components/wallet/wallet.tsx +++ b/packages/website/ts/components/wallet/wallet.tsx @@ -490,6 +490,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> { private _openWrappedEtherActionRow(wrappedEtherDirection: Side): void { const action = wrappedEtherDirection === Side.Deposit ? 'Wallet - Wrap ETH Opened' : 'Wallet - Unwrap WETH Opened'; + // tslint:disable-next-line:no-floating-promises analytics.trackAsync(action); this.setState({ wrappedEtherDirection, @@ -498,6 +499,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> { private _closeWrappedEtherActionRow(wrappedEtherDirection: Side): void { const action = wrappedEtherDirection === Side.Deposit ? 'Wallet - Wrap ETH Closed' : 'Wallet - Unwrap WETH Closed'; + // tslint:disable-next-line:no-floating-promises analytics.trackAsync(action); this.setState({ wrappedEtherDirection: undefined, diff --git a/packages/website/ts/components/wallet/wrap_ether_item.tsx b/packages/website/ts/components/wallet/wrap_ether_item.tsx index 9fec8afa1..9e3d06817 100644 --- a/packages/website/ts/components/wallet/wrap_ether_item.tsx +++ b/packages/website/ts/components/wallet/wrap_ether_item.tsx @@ -196,12 +196,14 @@ export class WrapEtherItem extends React.Component<WrapEtherItemProps, WrapEther if (this.props.direction === Side.Deposit) { await this.props.blockchain.convertEthToWrappedEthTokensAsync(etherToken.address, amountToConvert); this.props.dispatcher.showFlashMessage(`Successfully wrapped ${ethAmount} ETH to WETH`); + // tslint:disable-next-line:no-floating-promises analytics.trackAsync('Wrap ETH Success', { amount: ethAmount, }); } else { await this.props.blockchain.convertWrappedEthTokensToEthAsync(etherToken.address, amountToConvert); this.props.dispatcher.showFlashMessage(`Successfully unwrapped ${tokenAmount} WETH to ETH`); + // tslint:disable-next-line:no-floating-promises analytics.trackAsync('Unwrap WETH Success', { amount: tokenAmount, }); @@ -217,11 +219,13 @@ export class WrapEtherItem extends React.Component<WrapEtherItemProps, WrapEther logUtils.log(err.stack); if (this.props.direction === Side.Deposit) { this.props.dispatcher.showFlashMessage('Failed to wrap your ETH. Please try again.'); + // tslint:disable-next-line:no-floating-promises analytics.trackAsync('Wrap ETH Failure', { amount: ethAmount, }); } else { this.props.dispatcher.showFlashMessage('Failed to unwrap your WETH. Please try again.'); + // tslint:disable-next-line:no-floating-promises analytics.trackAsync('Unwrap WETH Failed', { amount: tokenAmount, }); diff --git a/packages/website/ts/redux/analyticsMiddleware.ts b/packages/website/ts/redux/analyticsMiddleware.ts index 2778445e7..e848ca3fd 100644 --- a/packages/website/ts/redux/analyticsMiddleware.ts +++ b/packages/website/ts/redux/analyticsMiddleware.ts @@ -8,28 +8,33 @@ export const analyticsMiddleware: Middleware = store => next => action => { const nextState = (store.getState() as any) as State; switch (action.type) { case ActionTypes.UpdateInjectedProviderName: + // tslint:disable-next-line:no-floating-promises analytics.addEventPropertiesAsync({ injectedProviderName: nextState.injectedProviderName, }); break; case ActionTypes.UpdateNetworkId: + // tslint:disable-next-line:no-floating-promises analytics.addEventPropertiesAsync({ networkId: nextState.networkId, }); break; case ActionTypes.UpdateUserAddress: + // tslint:disable-next-line:no-floating-promises analytics.addUserPropertiesAsync({ ethAddress: nextState.userAddress, }); break; case ActionTypes.UpdateUserEtherBalance: if (nextState.userEtherBalanceInWei) { + // tslint:disable-next-line:no-floating-promises analytics.addUserPropertiesAsync({ ethBalance: nextState.userEtherBalanceInWei.toString(), }); } break; case ActionTypes.UpdatePortalOnboardingStep: + // tslint:disable-next-line:no-floating-promises analytics.trackAsync('Update Onboarding Step', { stepIndex: nextState.portalOnboardingStep, }); diff --git a/packages/website/ts/utils/analytics.ts b/packages/website/ts/utils/analytics.ts index 961f9af5a..2ff9f8918 100644 --- a/packages/website/ts/utils/analytics.ts +++ b/packages/website/ts/utils/analytics.ts @@ -66,6 +66,7 @@ export class Analytics { takerToken: order.metadata.takerToken.symbol, makerToken: order.metadata.makerToken.symbol, }; + // tslint:disable-next-line:no-floating-promises this.trackAsync(eventName, orderLoggingData); } /** |