Skip to content

Commit

Permalink
Track network for addAccounts (#3959)
Browse files Browse the repository at this point in the history
* Track network for addAccounts

* Track setDemoMode

* Fix typo
  • Loading branch information
Emmanuel Vilsbol authored May 12, 2021
1 parent 49992d0 commit 0b5ba7e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
24 changes: 22 additions & 2 deletions src/services/Analytics/analytics.middleware.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { Action, Dispatch, Middleware } from '@reduxjs/toolkit';

import { addAccounts, createAsset, importState, setProductAnalyticsAuthorisation } from '@store';
import {
addAccounts,
createAsset,
importState,
setDemoMode,
setProductAnalyticsAuthorisation
} from '@store';

import { trackEvent } from './saga';

Expand All @@ -15,7 +21,12 @@ export const analyticsMiddleware: Middleware<TObject, any, Dispatch<Action>> = (
state.dispatch(
trackEvent({
name: 'Add Account',
params: { qty: action.payload.length, walletId: action.payload[0].wallet } // multiple add accounts are always of the same type.
params: {
qty: action.payload.length,
// multiple add accounts are always of the same type and network
walletId: action.payload[0].wallet,
networkId: action.payload[0].networkId
}
})
);
break;
Expand All @@ -31,6 +42,15 @@ export const analyticsMiddleware: Middleware<TObject, any, Dispatch<Action>> = (
break;
}

case setDemoMode.type: {
state.dispatch(
trackEvent({
name: 'Set Demo Mode'
})
);
break;
}

case setProductAnalyticsAuthorisation.type: {
state.dispatch(
trackEvent({
Expand Down
3 changes: 2 additions & 1 deletion src/services/Analytics/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export type TAnalyticEvents =
| 'Total Account Count'
| 'Deactivate analytics'
| 'Export AppState'
| 'Import AppState';
| 'Import AppState'
| 'Set Demo Mode';

0 comments on commit 0b5ba7e

Please sign in to comment.