aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/redux
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-12-04 08:01:37 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-12-04 08:01:37 +0800
commit7a03df946dc86ad2b9cc86947cf61bc74dcfbf3c (patch)
tree4d5d7e4fbc7c5bd78c30fa1eede7c9f8e7fff46e /packages/instant/src/redux
parente9fe7dcf54183416e114655595be4e565811d4ed (diff)
downloaddexon-sol-tools-7a03df946dc86ad2b9cc86947cf61bc74dcfbf3c.tar
dexon-sol-tools-7a03df946dc86ad2b9cc86947cf61bc74dcfbf3c.tar.gz
dexon-sol-tools-7a03df946dc86ad2b9cc86947cf61bc74dcfbf3c.tar.bz2
dexon-sol-tools-7a03df946dc86ad2b9cc86947cf61bc74dcfbf3c.tar.lz
dexon-sol-tools-7a03df946dc86ad2b9cc86947cf61bc74dcfbf3c.tar.xz
dexon-sol-tools-7a03df946dc86ad2b9cc86947cf61bc74dcfbf3c.tar.zst
dexon-sol-tools-7a03df946dc86ad2b9cc86947cf61bc74dcfbf3c.zip
feat(instant): Add eth balance, eth address, token symbol and decimals to event properties
Diffstat (limited to 'packages/instant/src/redux')
-rw-r--r--packages/instant/src/redux/analytics_middleware.ts18
1 files changed, 14 insertions, 4 deletions
diff --git a/packages/instant/src/redux/analytics_middleware.ts b/packages/instant/src/redux/analytics_middleware.ts
index 47876ca2d..9a98649f6 100644
--- a/packages/instant/src/redux/analytics_middleware.ts
+++ b/packages/instant/src/redux/analytics_middleware.ts
@@ -1,10 +1,11 @@
+import { AssetProxyId } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as _ from 'lodash';
import { Middleware } from 'redux';
import { ETH_DECIMALS } from '../constants';
import { AccountState, StandardSlidingPanelContent } from '../types';
-import { analytics } from '../util/analytics';
+import { analytics, AnalyticsEventOptions } from '../util/analytics';
import { Action, ActionTypes } from './actions';
@@ -29,9 +30,11 @@ export const analyticsMiddleware: Middleware = store => next => middlewareAction
if (didJustTurnReady) {
analytics.trackAccountReady(ethAddress);
analytics.addUserProperties({ lastKnownEthAddress: ethAddress });
+ analytics.addEventProperties({ ethAddress });
} else if (didJustUpdateAddress) {
analytics.trackAccountAddressChanged(ethAddress);
analytics.addUserProperties({ lastKnownEthAddress: ethAddress });
+ analytics.addEventProperties({ ethAddress });
}
}
break;
@@ -51,7 +54,8 @@ export const analyticsMiddleware: Middleware = store => next => middlewareAction
curAccount.ethBalanceInWei,
ETH_DECIMALS,
).toString();
- analytics.addUserProperties({ ethBalanceInUnitAmount });
+ analytics.addUserProperties({ ethBalanceInUnitAmount});
+ analytics.addEventProperties({ ethBalanceInUnitAmount });
}
break;
case ActionTypes.UPDATE_SELECTED_ASSET:
@@ -63,10 +67,16 @@ export const analyticsMiddleware: Middleware = store => next => middlewareAction
assetName,
assetData,
});
- analytics.addEventProperties({
+
+ const selectedAssetEventProperties: AnalyticsEventOptions = {
selectedAssetName: assetName,
selectedAssetData: assetData,
- });
+ };
+ if (selectedAsset.metaData.assetProxyId === AssetProxyId.ERC20) {
+ selectedAssetEventProperties.selectedAssetDecimals = selectedAsset.metaData.decimals;
+ selectedAssetEventProperties.selectedAssetSymbol = selectedAsset.metaData.symbol;
+ }
+ analytics.addEventProperties(selectedAssetEventProperties);
}
break;
case ActionTypes.SET_AVAILABLE_ASSETS: