From 685d83d6d0dc7998ce231e5106d74c0e16b17f34 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 21 Nov 2018 10:22:43 -0800 Subject: feat(instant): implement buy events without associated properties --- packages/instant/src/components/buy_button.tsx | 8 ++++++++ packages/instant/src/util/analytics.ts | 14 ++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'packages') diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx index 8b6121e43..6db71852e 100644 --- a/packages/instant/src/components/buy_button.tsx +++ b/packages/instant/src/components/buy_button.tsx @@ -8,6 +8,7 @@ import { oc } from 'ts-optchain'; import { WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX } from '../constants'; import { ColorOption } from '../style/theme'; import { AffiliateInfo, ZeroExInstantError } from '../types'; +import { analytics } from '../util/analytics'; import { gasPriceEstimator } from '../util/gas_price_estimator'; import { util } from '../util/util'; @@ -59,6 +60,7 @@ export class BuyButton extends React.Component { // if we don't have a balance for the user, let the transaction through, it will be handled by the wallet const hasSufficientEth = _.isUndefined(accountEthBalanceInWei) || accountEthBalanceInWei.gte(ethNeededForBuy); if (!hasSufficientEth) { + analytics.trackBuyNotEnoughEth(); this.props.onValidationFail(buyQuote, ZeroExInstantError.InsufficientETH); return; } @@ -66,17 +68,21 @@ export class BuyButton extends React.Component { const gasInfo = await gasPriceEstimator.getGasInfoAsync(); const feeRecipient = oc(affiliateInfo).feeRecipient(); try { + analytics.trackBuyStarted(); txHash = await assetBuyer.executeBuyQuoteAsync(buyQuote, { feeRecipient, takerAddress: accountAddress, gasPrice: gasInfo.gasPriceInWei, }); + analytics.trackBuyTxSubmitted(); } catch (e) { if (e instanceof Error) { if (e.message === AssetBuyerError.SignatureRequestDenied) { + analytics.trackBuySignatureDenied(); this.props.onSignatureDenied(buyQuote); return; } else if (e.message === AssetBuyerError.TransactionValueTooLow) { + analytics.trackBuySimulationFailed(); this.props.onValidationFail(buyQuote, AssetBuyerError.TransactionValueTooLow); return; } @@ -89,12 +95,14 @@ export class BuyButton extends React.Component { try { await web3Wrapper.awaitTransactionSuccessAsync(txHash); } catch (e) { + analytics.trackBuyTxFailed(); if (e instanceof Error && e.message.startsWith(WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX)) { this.props.onBuyFailure(buyQuote, txHash); return; } throw e; } + analytics.trackBuyTxSucceeded(); this.props.onBuySuccess(buyQuote, txHash); }; } diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts index e389e1530..bd3a62ef8 100644 --- a/packages/instant/src/util/analytics.ts +++ b/packages/instant/src/util/analytics.ts @@ -18,6 +18,13 @@ enum EventNames { ACCOUNT_UNLOCK_REQUESTED = 'Account - Unlock Requested', ACCOUNT_UNLOCK_DENIED = 'Account - Unlock Denied', ACCOUNT_ADDRESS_CHANGED = 'Account - Address Changed', + BUY_NOT_ENOUGH_ETH = 'Buy - Not Enough Eth', + BUY_STARTED = 'Buy - Started', + BUY_SIGNATURE_DENIED = 'Buy - Signature Denied', + BUY_SIMULATION_FAILED = 'Buy - Simulation Failed', + BUY_TX_SUBMITTED = 'Buy - Tx Submitted', + BUY_TX_SUCCEEDED = 'Buy - Tx Succeeded', + BUY_TX_FAILED = 'Buy - Tx Failed', } const track = (eventName: EventNames, eventProperties: EventProperties = {}): void => { evaluateIfEnabled(() => { @@ -67,4 +74,11 @@ export const analytics = { trackAccountUnlockDenied: trackingEventFnWithoutPayload(EventNames.ACCOUNT_UNLOCK_DENIED), trackAccountAddressChanged: (address: string) => trackingEventFnWithPayload(EventNames.ACCOUNT_ADDRESS_CHANGED)({ address }), + trackBuyNotEnoughEth: trackingEventFnWithoutPayload(EventNames.BUY_NOT_ENOUGH_ETH), + trackBuyStarted: trackingEventFnWithoutPayload(EventNames.BUY_STARTED), + trackBuySignatureDenied: trackingEventFnWithoutPayload(EventNames.BUY_SIGNATURE_DENIED), + trackBuySimulationFailed: trackingEventFnWithoutPayload(EventNames.BUY_SIMULATION_FAILED), + trackBuyTxSubmitted: trackingEventFnWithoutPayload(EventNames.BUY_TX_SUBMITTED), + trackBuyTxSucceeded: trackingEventFnWithoutPayload(EventNames.BUY_TX_SUCCEEDED), + trackBuyTxFailed: trackingEventFnWithoutPayload(EventNames.BUY_TX_FAILED), }; -- cgit v1.2.3 From fad48b8b6c5299b2fd3b8490779a538e1158f2dd Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 21 Nov 2018 15:18:31 -0800 Subject: feat(instant): add txHash to relevant buy events --- packages/instant/src/components/buy_button.tsx | 6 +++--- packages/instant/src/util/analytics.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'packages') diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx index 6db71852e..9a6785862 100644 --- a/packages/instant/src/components/buy_button.tsx +++ b/packages/instant/src/components/buy_button.tsx @@ -74,7 +74,7 @@ export class BuyButton extends React.Component { takerAddress: accountAddress, gasPrice: gasInfo.gasPriceInWei, }); - analytics.trackBuyTxSubmitted(); + analytics.trackBuyTxSubmitted(txHash); } catch (e) { if (e instanceof Error) { if (e.message === AssetBuyerError.SignatureRequestDenied) { @@ -95,14 +95,14 @@ export class BuyButton extends React.Component { try { await web3Wrapper.awaitTransactionSuccessAsync(txHash); } catch (e) { - analytics.trackBuyTxFailed(); + analytics.trackBuyTxFailed(txHash); if (e instanceof Error && e.message.startsWith(WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX)) { this.props.onBuyFailure(buyQuote, txHash); return; } throw e; } - analytics.trackBuyTxSucceeded(); + analytics.trackBuyTxSucceeded(txHash); this.props.onBuySuccess(buyQuote, txHash); }; } diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts index bd3a62ef8..5e55c8af3 100644 --- a/packages/instant/src/util/analytics.ts +++ b/packages/instant/src/util/analytics.ts @@ -78,7 +78,7 @@ export const analytics = { trackBuyStarted: trackingEventFnWithoutPayload(EventNames.BUY_STARTED), trackBuySignatureDenied: trackingEventFnWithoutPayload(EventNames.BUY_SIGNATURE_DENIED), trackBuySimulationFailed: trackingEventFnWithoutPayload(EventNames.BUY_SIMULATION_FAILED), - trackBuyTxSubmitted: trackingEventFnWithoutPayload(EventNames.BUY_TX_SUBMITTED), - trackBuyTxSucceeded: trackingEventFnWithoutPayload(EventNames.BUY_TX_SUCCEEDED), - trackBuyTxFailed: trackingEventFnWithoutPayload(EventNames.BUY_TX_FAILED), + trackBuyTxSubmitted: (txHash: string) => trackingEventFnWithPayload(EventNames.BUY_TX_SUBMITTED)({ txHash }), + trackBuyTxSucceeded: (txHash: string) => trackingEventFnWithPayload(EventNames.BUY_TX_SUCCEEDED)({ txHash }), + trackBuyTxFailed: (txHash: string) => trackingEventFnWithPayload(EventNames.BUY_TX_FAILED)({ txHash }), }; -- cgit v1.2.3 From 2795849dd3170542d3120a4e8c2493d29fa76a26 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 26 Nov 2018 14:47:46 -0800 Subject: feat(instant): add buyQuote properties to buy events --- packages/instant/src/components/buy_button.tsx | 14 ++++----- packages/instant/src/util/analytics.ts | 43 +++++++++++++++++++++----- 2 files changed, 43 insertions(+), 14 deletions(-) (limited to 'packages') diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx index 9a6785862..118e3c92f 100644 --- a/packages/instant/src/components/buy_button.tsx +++ b/packages/instant/src/components/buy_button.tsx @@ -60,7 +60,7 @@ export class BuyButton extends React.Component { // if we don't have a balance for the user, let the transaction through, it will be handled by the wallet const hasSufficientEth = _.isUndefined(accountEthBalanceInWei) || accountEthBalanceInWei.gte(ethNeededForBuy); if (!hasSufficientEth) { - analytics.trackBuyNotEnoughEth(); + analytics.trackBuyNotEnoughEth(buyQuote); this.props.onValidationFail(buyQuote, ZeroExInstantError.InsufficientETH); return; } @@ -68,21 +68,21 @@ export class BuyButton extends React.Component { const gasInfo = await gasPriceEstimator.getGasInfoAsync(); const feeRecipient = oc(affiliateInfo).feeRecipient(); try { - analytics.trackBuyStarted(); + analytics.trackBuyStarted(buyQuote); txHash = await assetBuyer.executeBuyQuoteAsync(buyQuote, { feeRecipient, takerAddress: accountAddress, gasPrice: gasInfo.gasPriceInWei, }); - analytics.trackBuyTxSubmitted(txHash); + analytics.trackBuyTxSubmitted(buyQuote, txHash); } catch (e) { if (e instanceof Error) { if (e.message === AssetBuyerError.SignatureRequestDenied) { - analytics.trackBuySignatureDenied(); + analytics.trackBuySignatureDenied(buyQuote); this.props.onSignatureDenied(buyQuote); return; } else if (e.message === AssetBuyerError.TransactionValueTooLow) { - analytics.trackBuySimulationFailed(); + analytics.trackBuySimulationFailed(buyQuote); this.props.onValidationFail(buyQuote, AssetBuyerError.TransactionValueTooLow); return; } @@ -95,14 +95,14 @@ export class BuyButton extends React.Component { try { await web3Wrapper.awaitTransactionSuccessAsync(txHash); } catch (e) { - analytics.trackBuyTxFailed(txHash); + analytics.trackBuyTxFailed(buyQuote, txHash); if (e instanceof Error && e.message.startsWith(WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX)) { this.props.onBuyFailure(buyQuote, txHash); return; } throw e; } - analytics.trackBuyTxSucceeded(txHash); + analytics.trackBuyTxSucceeded(buyQuote, txHash); this.props.onBuySuccess(buyQuote, txHash); }; } diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts index 5e55c8af3..0fe7be705 100644 --- a/packages/instant/src/util/analytics.ts +++ b/packages/instant/src/util/analytics.ts @@ -1,3 +1,6 @@ +import { BuyQuote } from '@0x/asset-buyer'; +import * as _ from 'lodash'; + import { EventProperties, heapUtil } from './heap'; let isDisabled = false; @@ -43,6 +46,25 @@ 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(); + const totalEthAmount = buyQuote.worstCaseQuoteInfo.totalEthAmount.toString(); + const feePercentage = !_.isUndefined(buyQuote.feePercentage) ? buyQuote.feePercentage.toString() : 0; + const hasFeeOrders = !_.isEmpty(buyQuote.feeOrders) ? 'true' : 'false'; + return { + assetData, + assetBuyAmount, + assetEthAmount, + feeEthAmount, + totalEthAmount, + feePercentage, + hasFeeOrders, + }; +}; + export interface AnalyticsUserOptions { lastKnownEthAddress?: string; ethBalanceInUnitAmount?: string; @@ -74,11 +96,18 @@ export const analytics = { trackAccountUnlockDenied: trackingEventFnWithoutPayload(EventNames.ACCOUNT_UNLOCK_DENIED), trackAccountAddressChanged: (address: string) => trackingEventFnWithPayload(EventNames.ACCOUNT_ADDRESS_CHANGED)({ address }), - trackBuyNotEnoughEth: trackingEventFnWithoutPayload(EventNames.BUY_NOT_ENOUGH_ETH), - trackBuyStarted: trackingEventFnWithoutPayload(EventNames.BUY_STARTED), - trackBuySignatureDenied: trackingEventFnWithoutPayload(EventNames.BUY_SIGNATURE_DENIED), - trackBuySimulationFailed: trackingEventFnWithoutPayload(EventNames.BUY_SIMULATION_FAILED), - trackBuyTxSubmitted: (txHash: string) => trackingEventFnWithPayload(EventNames.BUY_TX_SUBMITTED)({ txHash }), - trackBuyTxSucceeded: (txHash: string) => trackingEventFnWithPayload(EventNames.BUY_TX_SUCCEEDED)({ txHash }), - trackBuyTxFailed: (txHash: string) => trackingEventFnWithPayload(EventNames.BUY_TX_FAILED)({ txHash }), + trackBuyNotEnoughEth: (buyQuote: BuyQuote) => + trackingEventFnWithPayload(EventNames.BUY_NOT_ENOUGH_ETH)(buyQuoteEventProperties(buyQuote)), + trackBuyStarted: (buyQuote: BuyQuote) => + trackingEventFnWithPayload(EventNames.BUY_STARTED)(buyQuoteEventProperties(buyQuote)), + trackBuySignatureDenied: (buyQuote: BuyQuote) => + 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 }), }; -- cgit v1.2.3 From f3d08c13ebf337f4f5e174dd003cd436a6ad5417 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Mon, 26 Nov 2018 17:13:35 -0800 Subject: Add stable CSS classes --- packages/instant/src/components/zero_ex_instant_overlay.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/instant/src/components/zero_ex_instant_overlay.tsx b/packages/instant/src/components/zero_ex_instant_overlay.tsx index 2856ea3e3..7fbac7475 100644 --- a/packages/instant/src/components/zero_ex_instant_overlay.tsx +++ b/packages/instant/src/components/zero_ex_instant_overlay.tsx @@ -18,7 +18,7 @@ export const ZeroExInstantOverlay: React.StatelessComponent - + - + -- cgit v1.2.3 From d3b0162dc979ccdc4b4ddff62199929c714ad3ca Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 26 Nov 2018 23:08:20 -0800 Subject: feat(instant): add expectedEndTimeUnix and actualEndTimeUnix to buy events --- packages/instant/src/components/buy_button.tsx | 6 ++--- packages/instant/src/util/analytics.ts | 31 +++++++++++++++++++------- 2 files changed, 26 insertions(+), 11 deletions(-) (limited to 'packages') diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx index 118e3c92f..eeb42d6fc 100644 --- a/packages/instant/src/components/buy_button.tsx +++ b/packages/instant/src/components/buy_button.tsx @@ -74,7 +74,6 @@ export class BuyButton extends React.Component { takerAddress: accountAddress, gasPrice: gasInfo.gasPriceInWei, }); - analytics.trackBuyTxSubmitted(buyQuote, txHash); } catch (e) { if (e instanceof Error) { if (e.message === AssetBuyerError.SignatureRequestDenied) { @@ -93,16 +92,17 @@ export class BuyButton extends React.Component { const expectedEndTimeUnix = startTimeUnix + gasInfo.estimatedTimeMs; this.props.onBuyProcessing(buyQuote, txHash, startTimeUnix, expectedEndTimeUnix); try { + analytics.trackBuyTxSubmitted(buyQuote, txHash, startTimeUnix, expectedEndTimeUnix); await web3Wrapper.awaitTransactionSuccessAsync(txHash); } catch (e) { - analytics.trackBuyTxFailed(buyQuote, txHash); if (e instanceof Error && e.message.startsWith(WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX)) { + analytics.trackBuyTxFailed(buyQuote, txHash, startTimeUnix, expectedEndTimeUnix); this.props.onBuyFailure(buyQuote, txHash); return; } throw e; } - analytics.trackBuyTxSucceeded(buyQuote, txHash); + analytics.trackBuyTxSucceeded(buyQuote, txHash, startTimeUnix, expectedEndTimeUnix); this.props.onBuySuccess(buyQuote, txHash); }; } 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(), + }), }; -- cgit v1.2.3 From e08fb72cf10f5260966e4dfd84873c326ff4ea61 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Tue, 27 Nov 2018 09:01:49 -0800 Subject: Use constants --- packages/instant/src/components/zero_ex_instant_overlay.tsx | 5 +++-- packages/instant/src/constants.ts | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/instant/src/components/zero_ex_instant_overlay.tsx b/packages/instant/src/components/zero_ex_instant_overlay.tsx index 7fbac7475..b3fb57dd6 100644 --- a/packages/instant/src/components/zero_ex_instant_overlay.tsx +++ b/packages/instant/src/components/zero_ex_instant_overlay.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import { ZeroExInstantContainer } from '../components/zero_ex_instant_container'; +import { MAIN_CONTAINER_DIV_CLASS, OVERLAY_DIV_CLASS } from '../constants'; import { ColorOption } from '../style/theme'; import { Container } from './ui/container'; @@ -18,7 +19,7 @@ export const ZeroExInstantOverlay: React.StatelessComponent - + diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts index be6077ca9..163be40b3 100644 --- a/packages/instant/src/constants.ts +++ b/packages/instant/src/constants.ts @@ -7,6 +7,8 @@ export const ETH_DECIMALS = 18; export const DEFAULT_ZERO_EX_CONTAINER_SELECTOR = '#zeroExInstantContainer'; export const INJECTED_DIV_CLASS = 'zeroExInstantResetRoot'; export const INJECTED_DIV_ID = 'zeroExInstant'; +export const OVERLAY_DIV_CLASS = 'zeroExInstantOverlay'; +export const MAIN_CONTAINER_DIV_CLASS = 'zeroExInstantMainContainer'; export const WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX = 'Transaction failed'; export const GWEI_IN_WEI = new BigNumber(1000000000); export const ONE_SECOND_MS = 1000; -- cgit v1.2.3 From 6e2523625f6a29bfcf58bf032d0cd3a468053247 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Tue, 27 Nov 2018 10:17:59 -0800 Subject: feat(instant): change event properties to ms times instead of unix timestamps --- packages/instant/src/util/analytics.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'packages') diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts index d45d37b3b..c2fe7b0e7 100644 --- a/packages/instant/src/util/analytics.ts +++ b/packages/instant/src/util/analytics.ts @@ -133,23 +133,20 @@ export const analytics = { trackingEventFnWithPayload(EventNames.BUY_TX_SUBMITTED)({ ...buyQuoteEventProperties(buyQuote), txHash, - startTimeUnix, - expectedEndTimeUnix, + expectedTxTimeMs: expectedEndTimeUnix - startTimeUnix, }), trackBuyTxSucceeded: (buyQuote: BuyQuote, txHash: string, startTimeUnix: number, expectedEndTimeUnix: number) => trackingEventFnWithPayload(EventNames.BUY_TX_SUCCEEDED)({ ...buyQuoteEventProperties(buyQuote), txHash, - startTimeUnix, - expectedEndTimeUnix, - actualEndTimeUnix: new Date().getTime(), + expectedTxTimeMs: expectedEndTimeUnix - startTimeUnix, + actualTxTimeMs: new Date().getTime() - startTimeUnix, }), trackBuyTxFailed: (buyQuote: BuyQuote, txHash: string, startTimeUnix: number, expectedEndTimeUnix: number) => trackingEventFnWithPayload(EventNames.BUY_TX_FAILED)({ ...buyQuoteEventProperties(buyQuote), txHash, - startTimeUnix, - expectedEndTimeUnix, - actualEndTimeUnix: new Date().getTime(), + expectedTxTimeMs: expectedEndTimeUnix - startTimeUnix, + actualTxTimeMs: new Date().getTime() - startTimeUnix, }), }; -- cgit v1.2.3 From 435e62a94df3d98e8321f5ecc3a984b495313f92 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Tue, 27 Nov 2018 10:32:54 -0800 Subject: fix(instant): Fix copy to clipboard --- packages/instant/src/components/payment_method_dropdown.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/instant/src/components/payment_method_dropdown.tsx b/packages/instant/src/components/payment_method_dropdown.tsx index b330dbcd6..0226d1f01 100644 --- a/packages/instant/src/components/payment_method_dropdown.tsx +++ b/packages/instant/src/components/payment_method_dropdown.tsx @@ -1,5 +1,5 @@ import { BigNumber } from '@0x/utils'; -import copy from 'copy-to-clipboard'; +import * as copy from 'copy-to-clipboard'; import * as React from 'react'; import { Network } from '../types'; -- cgit v1.2.3