diff options
author | Steve Klebanoff <steve@0xproject.com> | 2018-12-05 09:20:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-05 09:20:58 +0800 |
commit | 4e7031e96d9f3b6548abfc58d06e94ebde102bcf (patch) | |
tree | 9d069c75154687ed5fe29d3b93a1e690ba2b86c2 /packages/instant/src/redux | |
parent | a8a6baf964707e469c35c7ccab68262897facb8f (diff) | |
parent | 04226106a293f5e716bb3e268e89c7b231da96aa (diff) | |
download | dexon-0x-contracts-4e7031e96d9f3b6548abfc58d06e94ebde102bcf.tar dexon-0x-contracts-4e7031e96d9f3b6548abfc58d06e94ebde102bcf.tar.gz dexon-0x-contracts-4e7031e96d9f3b6548abfc58d06e94ebde102bcf.tar.bz2 dexon-0x-contracts-4e7031e96d9f3b6548abfc58d06e94ebde102bcf.tar.lz dexon-0x-contracts-4e7031e96d9f3b6548abfc58d06e94ebde102bcf.tar.xz dexon-0x-contracts-4e7031e96d9f3b6548abfc58d06e94ebde102bcf.tar.zst dexon-0x-contracts-4e7031e96d9f3b6548abfc58d06e94ebde102bcf.zip |
Merge pull request #1371 from 0xProject/feature/instant/log-decimals-and-add-event-properties
feat(instant): More event properties for tracking
Diffstat (limited to 'packages/instant/src/redux')
-rw-r--r-- | packages/instant/src/redux/analytics_middleware.ts | 18 |
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..3f7a51707 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({ lastEthBalanceInUnitAmount: 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: |