diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-28 07:28:38 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-28 07:28:38 +0800 |
commit | d3739488aed89ce98e805d48ec14a0d2608f85d7 (patch) | |
tree | c74e0f3f472d5e77cd2b57eddc515213555f7c7a /packages | |
parent | c5d6b925e4e04d5b6cfd0623d0a1449ba69d3a30 (diff) | |
download | dexon-0x-contracts-d3739488aed89ce98e805d48ec14a0d2608f85d7.tar.gz dexon-0x-contracts-d3739488aed89ce98e805d48ec14a0d2608f85d7.tar.zst dexon-0x-contracts-d3739488aed89ce98e805d48ec14a0d2608f85d7.zip |
Tracking quote errors
Diffstat (limited to 'packages')
-rw-r--r-- | packages/instant/src/util/analytics.ts | 16 | ||||
-rw-r--r-- | packages/instant/src/util/buy_quote_updater.ts | 7 |
2 files changed, 23 insertions, 0 deletions
diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts index 204b6921d..dd6021453 100644 --- a/packages/instant/src/util/analytics.ts +++ b/packages/instant/src/util/analytics.ts @@ -1,4 +1,5 @@ import { BuyQuote } from '@0x/asset-buyer'; +import { BigNumber } from '@0x/utils'; import * as _ from 'lodash'; import { AffiliateInfo, Asset, Network, OrderSource, ProviderState, QuoteFetchedVia } from '../types'; @@ -184,4 +185,19 @@ export const analytics = { ...buyQuoteEventProperties(buyQuote), fetchedVia, }), + trackQuoteError: ( + errorMessage: string, + assetName: string, + assetData: string, + assetAmount: BigNumber, + fetchedVia: QuoteFetchedVia, + ) => { + trackingEventFnWithPayload(EventNames.QUOTE_ERROR)({ + errorMessage, + assetName, + assetData, + assetAmount: assetAmount.toString(), + fetchedVia, + }); + }, }; diff --git a/packages/instant/src/util/buy_quote_updater.ts b/packages/instant/src/util/buy_quote_updater.ts index 59d3a85af..3c982ed1f 100644 --- a/packages/instant/src/util/buy_quote_updater.ts +++ b/packages/instant/src/util/buy_quote_updater.ts @@ -37,6 +37,13 @@ export const buyQuoteUpdater = { } catch (error) { if (options.dispatchErrors) { dispatch(actions.setQuoteRequestStateFailure()); + analytics.trackQuoteError( + error.message ? error.message : 'other', + asset.metaData.name, + asset.assetData, + assetUnitAmount, + options.fetchedVia, + ); let errorMessage; if (error.message === AssetBuyerError.InsufficientAssetLiquidity) { const assetName = assetUtils.bestNameForAsset(asset, 'of this asset'); |