aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util/analytics.ts
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-11-27 15:08:20 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-11-27 15:08:20 +0800
commitd3b0162dc979ccdc4b4ddff62199929c714ad3ca (patch)
tree1dc7a93c9376223c7645086739adfc3328d08fed /packages/instant/src/util/analytics.ts
parent2795849dd3170542d3120a4e8c2493d29fa76a26 (diff)
downloaddexon-0x-contracts-d3b0162dc979ccdc4b4ddff62199929c714ad3ca.tar.gz
dexon-0x-contracts-d3b0162dc979ccdc4b4ddff62199929c714ad3ca.tar.zst
dexon-0x-contracts-d3b0162dc979ccdc4b4ddff62199929c714ad3ca.zip
feat(instant): add expectedEndTimeUnix and actualEndTimeUnix to buy events
Diffstat (limited to 'packages/instant/src/util/analytics.ts')
-rw-r--r--packages/instant/src/util/analytics.ts31
1 files changed, 23 insertions, 8 deletions
diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts
index 0fe7be705..283695ef8 100644
--- a/packages/instant/src/util/analytics.ts
+++ b/packages/instant/src/util/analytics.ts
@@ -47,7 +47,6 @@ function trackingEventFnWithPayload(eventName: EventNames): (eventProperties: Ev
}
const buyQuoteEventProperties = (buyQuote: BuyQuote) => {
- const assetData = buyQuote.assetData.toString();
const assetBuyAmount = buyQuote.assetBuyAmount.toString();
const assetEthAmount = buyQuote.worstCaseQuoteInfo.assetEthAmount.toString();
const feeEthAmount = buyQuote.worstCaseQuoteInfo.feeEthAmount.toString();
@@ -55,7 +54,6 @@ const buyQuoteEventProperties = (buyQuote: BuyQuote) => {
const feePercentage = !_.isUndefined(buyQuote.feePercentage) ? buyQuote.feePercentage.toString() : 0;
const hasFeeOrders = !_.isEmpty(buyQuote.feeOrders) ? 'true' : 'false';
return {
- assetData,
assetBuyAmount,
assetEthAmount,
feeEthAmount,
@@ -104,10 +102,27 @@ export const analytics = {
trackingEventFnWithPayload(EventNames.BUY_SIGNATURE_DENIED)(buyQuoteEventProperties(buyQuote)),
trackBuySimulationFailed: (buyQuote: BuyQuote) =>
trackingEventFnWithPayload(EventNames.BUY_SIMULATION_FAILED)(buyQuoteEventProperties(buyQuote)),
- trackBuyTxSubmitted: (buyQuote: BuyQuote, txHash: string) =>
- trackingEventFnWithPayload(EventNames.BUY_TX_SUBMITTED)({ ...buyQuoteEventProperties(buyQuote), txHash }),
- trackBuyTxSucceeded: (buyQuote: BuyQuote, txHash: string) =>
- trackingEventFnWithPayload(EventNames.BUY_TX_SUCCEEDED)({ ...buyQuoteEventProperties(buyQuote), txHash }),
- trackBuyTxFailed: (buyQuote: BuyQuote, txHash: string) =>
- trackingEventFnWithPayload(EventNames.BUY_TX_FAILED)({ ...buyQuoteEventProperties(buyQuote), txHash }),
+ trackBuyTxSubmitted: (buyQuote: BuyQuote, txHash: string, startTimeUnix: number, expectedEndTimeUnix: number) =>
+ trackingEventFnWithPayload(EventNames.BUY_TX_SUBMITTED)({
+ ...buyQuoteEventProperties(buyQuote),
+ txHash,
+ startTimeUnix,
+ expectedEndTimeUnix,
+ }),
+ trackBuyTxSucceeded: (buyQuote: BuyQuote, txHash: string, startTimeUnix: number, expectedEndTimeUnix: number) =>
+ trackingEventFnWithPayload(EventNames.BUY_TX_SUCCEEDED)({
+ ...buyQuoteEventProperties(buyQuote),
+ txHash,
+ startTimeUnix,
+ expectedEndTimeUnix,
+ actualEndTimeUnix: new Date().getTime(),
+ }),
+ trackBuyTxFailed: (buyQuote: BuyQuote, txHash: string, startTimeUnix: number, expectedEndTimeUnix: number) =>
+ trackingEventFnWithPayload(EventNames.BUY_TX_FAILED)({
+ ...buyQuoteEventProperties(buyQuote),
+ txHash,
+ startTimeUnix,
+ expectedEndTimeUnix,
+ actualEndTimeUnix: new Date().getTime(),
+ }),
};