diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-10 23:53:42 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-10 23:53:42 +0800 |
commit | cea8dcae3dac2265d3780c95d6581fe48e9b94a4 (patch) | |
tree | 527d82d0123ec38924c4459b833131f379e20f71 /packages/website/ts/components/fill_order.tsx | |
parent | fc7e7d9331692510b2cf5baebcff948ebf0afc07 (diff) | |
download | dexon-0x-contracts-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.tar dexon-0x-contracts-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.tar.gz dexon-0x-contracts-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.tar.bz2 dexon-0x-contracts-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.tar.lz dexon-0x-contracts-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.tar.xz dexon-0x-contracts-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.tar.zst dexon-0x-contracts-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.zip |
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
Diffstat (limited to 'packages/website/ts/components/fill_order.tsx')
-rw-r--r-- | packages/website/ts/components/fill_order.tsx | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx index e9127288d..11b756d8e 100644 --- a/packages/website/ts/components/fill_order.tsx +++ b/packages/website/ts/components/fill_order.tsx @@ -7,7 +7,6 @@ import { Card, CardHeader, CardText } from 'material-ui/Card'; import Divider from 'material-ui/Divider'; import RaisedButton from 'material-ui/RaisedButton'; import * as React from 'react'; -import * as ReactGA from 'react-ga'; import { Link } from 'react-router-dom'; import { Blockchain } from 'ts/blockchain'; import { TrackTokenConfirmationDialog } from 'ts/components/dialogs/track_token_confirmation_dialog'; @@ -24,6 +23,7 @@ import { validator } from 'ts/schemas/validator'; import { AlertTypes, BlockchainErrs, Order, Token, TokenByAddress, WebsitePaths } 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'; interface FillOrderProps { @@ -544,12 +544,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { signedOrder, this.props.orderFillAmount, ); - ReactGA.event({ - category: 'Portal', - action: 'Fill Order Success', - label: eventLabel, - value: parsedOrder.signedOrder.takerTokenAmount, - }); + analytics.logEvent('Portal', 'Fill Order Success', eventLabel, parsedOrder.signedOrder.takerTokenAmount); // After fill completes, let's force fetch the token balances this.props.dispatcher.forceTokenStateRefetch(); this.setState({ @@ -563,12 +558,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { this.setState({ isFilling: false, }); - ReactGA.event({ - category: 'Portal', - action: 'Fill Order Failure', - label: eventLabel, - value: parsedOrder.signedOrder.takerTokenAmount, - }); + analytics.logEvent('Portal', 'Fill Order Failure', eventLabel, parsedOrder.signedOrder.takerTokenAmount); const errMsg = `${err}`; if (utils.didUserDenyWeb3Request(errMsg)) { return; @@ -633,12 +623,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { globalErrMsg: '', unavailableTakerAmount: takerTokenAmount, }); - ReactGA.event({ - category: 'Portal', - action: 'Cancel Order Success', - label: eventLabel, - value: parsedOrder.signedOrder.makerTokenAmount, - }); + analytics.logEvent('Portal', 'Cancel Order Success', eventLabel, parsedOrder.signedOrder.makerTokenAmount); return; } catch (err) { this.setState({ @@ -648,12 +633,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { if (utils.didUserDenyWeb3Request(errMsg)) { return; } - ReactGA.event({ - category: 'Portal', - action: 'Cancel Order Failure', - label: eventLabel, - value: parsedOrder.signedOrder.makerTokenAmount, - }); + analytics.logEvent('Portal', 'Cancel Order Failure', eventLabel, parsedOrder.signedOrder.makerTokenAmount); globalErrMsg = 'Failed to cancel order, please refresh and try again'; utils.consoleLog(`${err}`); this.setState({ |