aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-28 07:28:38 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-28 07:28:38 +0800
commitd3739488aed89ce98e805d48ec14a0d2608f85d7 (patch)
treec74e0f3f472d5e77cd2b57eddc515213555f7c7a /packages/instant/src/util
parentc5d6b925e4e04d5b6cfd0623d0a1449ba69d3a30 (diff)
downloaddexon-sol-tools-d3739488aed89ce98e805d48ec14a0d2608f85d7.tar.gz
dexon-sol-tools-d3739488aed89ce98e805d48ec14a0d2608f85d7.tar.zst
dexon-sol-tools-d3739488aed89ce98e805d48ec14a0d2608f85d7.zip
Tracking quote errors
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r--packages/instant/src/util/analytics.ts16
-rw-r--r--packages/instant/src/util/buy_quote_updater.ts7
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');