aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util/analytics.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-12-19 00:59:15 +0800
committerFabio Berger <me@fabioberger.com>2018-12-19 00:59:15 +0800
commit622b9f662e74d571da745047ede097c7a392d09e (patch)
tree68a9517882b04a3d428f6996e0790ceb82e89be4 /packages/instant/src/util/analytics.ts
parente295eeb8938468b1527d5d81f212766cef40bc81 (diff)
parent67df5a433d68a2af1a3a03a8bf431629a534dc97 (diff)
downloaddexon-0x-contracts-622b9f662e74d571da745047ede097c7a392d09e.tar
dexon-0x-contracts-622b9f662e74d571da745047ede097c7a392d09e.tar.gz
dexon-0x-contracts-622b9f662e74d571da745047ede097c7a392d09e.tar.bz2
dexon-0x-contracts-622b9f662e74d571da745047ede097c7a392d09e.tar.lz
dexon-0x-contracts-622b9f662e74d571da745047ede097c7a392d09e.tar.xz
dexon-0x-contracts-622b9f662e74d571da745047ede097c7a392d09e.tar.zst
dexon-0x-contracts-622b9f662e74d571da745047ede097c7a392d09e.zip
Merge branch 'development' into features/orderwatcher_ws
* development: (107 commits) Fix OrderWatcher title to fix sidebar top Fix version picker so it doesn't overflow onto two lines Fix bug in pull_missing_blocks with incorrect start block (#1438) Pull approval events for ZRX and DAI (#1430) fix semicolon and apply prettier Fix dex order quote/base asset assigning (#1432) Apply prettier Publish Updated CHANGELOGS Rename contracts CHANGELOGs to DEPLOYs Move Forwarder CHANGELOG entries to extensions CHANGELOG Make contracts packages not private Publish Updated CHANGELOGS Show @ price in light grey Updated CHANGELOGS typeof -> isString add special case to scrape OHLCV for eth/usd (#1428) run linter simplify scaling input logic ...
Diffstat (limited to 'packages/instant/src/util/analytics.ts')
-rw-r--r--packages/instant/src/util/analytics.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts
index 6da52db16..6c63907dc 100644
--- a/packages/instant/src/util/analytics.ts
+++ b/packages/instant/src/util/analytics.ts
@@ -6,6 +6,7 @@ import { GIT_SHA, HEAP_ENABLED, INSTANT_DISCHARGE_TARGET, NODE_ENV, NPM_PACKAGE_
import {
AffiliateInfo,
Asset,
+ BaseCurrency,
Network,
OrderProcessState,
OrderSource,
@@ -37,6 +38,7 @@ enum EventNames {
ACCOUNT_UNLOCK_REQUESTED = 'Account - Unlock Requested',
ACCOUNT_UNLOCK_DENIED = 'Account - Unlock Denied',
ACCOUNT_ADDRESS_CHANGED = 'Account - Address Changed',
+ BASE_CURRENCY_CHANGED = 'Base Currency - Changed',
PAYMENT_METHOD_DROPDOWN_OPENED = 'Payment Method - Dropdown Opened',
PAYMENT_METHOD_OPENED_ETHERSCAN = 'Payment Method - Opened Etherscan',
PAYMENT_METHOD_COPIED_ADDRESS = 'Payment Method - Copied Address',
@@ -47,6 +49,7 @@ enum EventNames {
BUY_TX_SUBMITTED = 'Buy - Tx Submitted',
BUY_TX_SUCCEEDED = 'Buy - Tx Succeeded',
BUY_TX_FAILED = 'Buy - Tx Failed',
+ USD_PRICE_FETCH_FAILED = 'USD Price - Fetch Failed',
INSTALL_WALLET_CLICKED = 'Install Wallet - Clicked',
INSTALL_WALLET_MODAL_OPENED = 'Install Wallet - Modal - Opened',
INSTALL_WALLET_MODAL_CLICKED_EXPLANATION = 'Install Wallet - Modal - Clicked Explanation',
@@ -106,6 +109,7 @@ export interface AnalyticsEventOptions {
ethAddress?: string;
networkId?: number;
providerName?: string;
+ providerDisplayName?: string;
gitSha?: string;
npmVersion?: string;
instantEnvironment?: string;
@@ -117,6 +121,7 @@ export interface AnalyticsEventOptions {
selectedAssetSymbol?: string;
selectedAssetData?: string;
selectedAssetDecimals?: number;
+ baseCurrency?: string;
}
export enum TokenSelectorClosedVia {
ClickedX = 'Clicked X',
@@ -140,6 +145,7 @@ export const analytics = {
window: Window,
selectedAsset?: Asset,
affiliateInfo?: AffiliateInfo,
+ baseCurrency?: BaseCurrency,
): AnalyticsEventOptions => {
const affiliateAddress = affiliateInfo ? affiliateInfo.feeRecipient : 'none';
const affiliateFeePercent = affiliateInfo ? parseFloat(affiliateInfo.feePercentage.toFixed(4)) : 0;
@@ -149,6 +155,7 @@ export const analytics = {
embeddedUrl: window.location.href,
networkId: network,
providerName: providerState.name,
+ providerDisplayName: providerState.displayName,
gitSha: GIT_SHA,
npmVersion: NPM_PACKAGE_VERSION,
orderSource: orderSourceName,
@@ -157,6 +164,7 @@ export const analytics = {
selectedAssetName: selectedAsset ? selectedAsset.metaData.name : 'none',
selectedAssetData: selectedAsset ? selectedAsset.assetData : 'none',
instantEnvironment: INSTANT_DISCHARGE_TARGET || `Local ${NODE_ENV}`,
+ baseCurrency,
};
return eventOptions;
},
@@ -168,6 +176,8 @@ export const analytics = {
trackAccountUnlockDenied: trackingEventFnWithoutPayload(EventNames.ACCOUNT_UNLOCK_DENIED),
trackAccountAddressChanged: (address: string) =>
trackingEventFnWithPayload(EventNames.ACCOUNT_ADDRESS_CHANGED)({ address }),
+ trackBaseCurrencyChanged: (currencyChangedTo: BaseCurrency) =>
+ trackingEventFnWithPayload(EventNames.BASE_CURRENCY_CHANGED)({ currencyChangedTo }),
trackPaymentMethodDropdownOpened: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_DROPDOWN_OPENED),
trackPaymentMethodOpenedEtherscan: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_OPENED_ETHERSCAN),
trackPaymentMethodCopiedAddress: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_COPIED_ADDRESS),
@@ -228,4 +238,5 @@ export const analytics = {
fetchOrigin,
});
},
+ trackUsdPriceFailed: trackingEventFnWithoutPayload(EventNames.USD_PRICE_FETCH_FAILED),
};