diff --git a/shared/constants/metametrics.ts b/shared/constants/metametrics.ts index 453ba97ea..f69a09169 100644 --- a/shared/constants/metametrics.ts +++ b/shared/constants/metametrics.ts @@ -583,10 +583,19 @@ export enum MetaMetricsEventName { WalletSetupFailed = 'Wallet Setup Failed', WalletCreated = 'Wallet Created', ///: BEGIN:ONLY_INCLUDE_IN(build-mmi) - UserClickedDeepLink = 'User Clicked Deeplink', - UserClickedConnectCustodialAccount = 'Clicked Connect Custodial Account', - UserClickedPortfolioButton = 'Clicked Portfolio Button', - UserClickedCompliance = 'Clicked Compliance', + DeeplinkClicked = 'Deeplink Clicked', + ConnectCustodialAccountClicked = 'Connect Custodial Account Clicked', + MMIPortfolioButtonClicked = 'MMI Portfolio Button Clicked', + StakeButtonClicked = 'Stake Button Clicked', + ComplianceButtonClicked = 'Compliance Button Clicked', + RefreshTokenListClicked = 'Refresh Token List Clicked', + SignatureDeeplinkDisplayed = 'Signature Deeplink Displayed', + InstitutionalFeatureConnected = 'Institutional Feature Connected', + CustodianSelected = 'Custodian Selected', + CustodianConnected = 'Custodian Connected', + CustodianConnectionCanceled = 'Custodian Connection Canceled', + CustodianConnectionFailed = 'Custodian Connection Failed', + CustodialAccountsConnected = 'Custodial Accounts Connected', ///: END:ONLY_INCLUDE_IN AccountDetailMenuOpened = 'Account Details Menu Opened', BlockExplorerLinkClicked = 'Block Explorer Clicked', diff --git a/ui/components/app/signature-request/signature-request.component.js b/ui/components/app/signature-request/signature-request.component.js index 601d73e35..f5eda00e9 100644 --- a/ui/components/app/signature-request/signature-request.component.js +++ b/ui/components/app/signature-request/signature-request.component.js @@ -11,7 +11,12 @@ import { shortenAddress, ///: END:ONLY_INCLUDE_IN } from '../../../helpers/utils/util'; -import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics'; +import { + MetaMetricsEventCategory, + ///: BEGIN:ONLY_INCLUDE_IN(build-mmi) + MetaMetricsEventName, + ///: END:ONLY_INCLUDE_IN +} from '../../../../shared/constants/metametrics'; import SiteOrigin from '../../ui/site-origin'; import Button from '../../ui/button'; import ContractDetailsModal from '../modals/contract-details-modal/contract-details-modal'; @@ -121,8 +126,8 @@ export default class SignatureRequest extends PureComponent { onDeepLinkFetched: () => undefined, onDeepLinkShown: () => { this.context.trackEvent({ - category: 'MMI', - event: 'Show deeplink for signature', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.SignatureDeeplinkDisplayed, }); }, }); diff --git a/ui/components/app/wallet-overview/eth-overview.js b/ui/components/app/wallet-overview/eth-overview.js index 4cafa0514..301331182 100644 --- a/ui/components/app/wallet-overview/eth-overview.js +++ b/ui/components/app/wallet-overview/eth-overview.js @@ -73,15 +73,15 @@ const EthOverview = ({ className, showAddress }) => { const portfolioEvent = () => { trackEvent({ - category: 'Navigation', - event: 'Clicked Portfolio Button', + category: MetaMetricsEventCategory.Navigation, + event: MetaMetricsEventName.MMIPortfolioButtonClicked, }); }; const stakingEvent = () => { trackEvent({ - category: 'Navigation', - event: 'Clicked Stake Button', + category: MetaMetricsEventCategory.Navigation, + event: MetaMetricsEventName.MMIPortfolioButtonClicked, }); }; diff --git a/ui/components/institutional/custody-confirm-link-modal/custody-confirm-link-modal.js b/ui/components/institutional/custody-confirm-link-modal/custody-confirm-link-modal.js index e7d0c4d5b..f4c15c412 100644 --- a/ui/components/institutional/custody-confirm-link-modal/custody-confirm-link-modal.js +++ b/ui/components/institutional/custody-confirm-link-modal/custody-confirm-link-modal.js @@ -70,7 +70,7 @@ const CustodyConfirmLink = ({ hideModal }) => { trackEvent({ category: MetaMetricsEventCategory.MMI, - event: MetaMetricsEventName.UserClickedDeepLink, + event: MetaMetricsEventName.DeeplinkClicked, }); dispatch(mmiActions.setWaitForConfirmDeepLinkDialog(false)); dispatch(hideModal()); diff --git a/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.js b/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.js index 232f4817f..eae1529f2 100644 --- a/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.js +++ b/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.js @@ -26,6 +26,10 @@ import { TextAlign, AlignItems, } from '../../../helpers/constants/design-system'; +import { + MetaMetricsEventCategory, + MetaMetricsEventName, +} from '../../../../shared/constants/metametrics'; const InteractiveReplacementTokenModal = () => { const t = useI18nContext(); @@ -55,8 +59,8 @@ const InteractiveReplacementTokenModal = () => { }); trackEvent({ - category: 'MMI', - event: 'User clicked refresh token link', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.ComplianceButtonClicked, }); }; diff --git a/ui/components/multichain/account-list-menu/account-list-menu.js b/ui/components/multichain/account-list-menu/account-list-menu.js index 80c1b91f4..6f3935e4d 100644 --- a/ui/components/multichain/account-list-menu/account-list-menu.js +++ b/ui/components/multichain/account-list-menu/account-list-menu.js @@ -298,7 +298,7 @@ export const AccountListMenu = ({ onClose }) => { trackEvent({ category: MetaMetricsEventCategory.Navigation, event: - MetaMetricsEventName.UserClickedConnectCustodialAccount, + MetaMetricsEventName.ConnectCustodialAccountClicked, }); if (getEnvironmentType() === ENVIRONMENT_TYPE_POPUP) { global.platform.openExtensionInBrowser( diff --git a/ui/components/multichain/global-menu/global-menu.js b/ui/components/multichain/global-menu/global-menu.js index 350f15947..1de3222ac 100644 --- a/ui/components/multichain/global-menu/global-menu.js +++ b/ui/components/multichain/global-menu/global-menu.js @@ -113,7 +113,7 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => { onClick={() => { trackEvent({ category: MetaMetricsEventCategory.Navigation, - event: MetaMetricsEventName.UserClickedPortfolioButton, + event: MetaMetricsEventName.MMIPortfolioButtonClicked, }); window.open(mmiPortfolioUrl, '_blank'); closeMenu(); diff --git a/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.js b/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.js index 4f0257e77..f49144ac4 100644 --- a/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.js +++ b/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.js @@ -26,6 +26,10 @@ import { Box, } from '../../../components/component-library'; import { Text } from '../../../components/component-library/text/deprecated'; +import { + MetaMetricsEventCategory, + MetaMetricsEventName, +} from '../../../../shared/constants/metametrics'; import { complianceActivated, getInstitutionalConnectRequests, @@ -59,8 +63,8 @@ const ConfirmAddCustodianToken = () => { } trackEvent({ - category: 'MMI', - event: 'Custodian onboarding', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.TokenAdded, properties: { actions: 'Custodian RPC request', custodian: connectRequest.custodian, @@ -184,8 +188,8 @@ const ConfirmAddCustodianToken = () => { ); trackEvent({ - category: 'MMI', - event: 'Custodian onboarding', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.TokenAdded, properties: { actions: 'Custodian RPC cancel', custodian: connectRequest.custodian, @@ -238,8 +242,8 @@ const ConfirmAddCustodianToken = () => { ); trackEvent({ - category: 'MMI', - event: 'Custodian onboarding', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.TokenAdded, properties: { actions: 'Custodian RPC confirm', custodian: connectRequest.custodian, diff --git a/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.js b/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.js index 627f7acb3..bc528a094 100644 --- a/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.js +++ b/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.js @@ -21,6 +21,10 @@ import { } from '../../../helpers/constants/design-system'; import Box from '../../../components/ui/box'; import { mmiActionsFactory } from '../../../store/institutional/institution-background'; +import { + MetaMetricsEventCategory, + MetaMetricsEventName, +} from '../../../../shared/constants/metametrics'; export default function ConfirmAddInstitutionalFeature({ history }) { const t = useI18nContext(); @@ -52,8 +56,8 @@ export default function ConfirmAddInstitutionalFeature({ history }) { const sendEvent = ({ actions, service }) => { trackEvent({ - category: 'MMI', - event: 'Institutional feature connection', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.InstitutionalFeatureConnected, properties: { actions, service, diff --git a/ui/pages/institutional/custody/custody.js b/ui/pages/institutional/custody/custody.js index d9825ead9..f5e573454 100644 --- a/ui/pages/institutional/custody/custody.js +++ b/ui/pages/institutional/custody/custody.js @@ -44,6 +44,10 @@ import { getCurrentChainId, getSelectedAddress } from '../../../selectors'; import { getMMIConfiguration } from '../../../selectors/institutional/selectors'; import CustodyAccountList from '../connect-custody/account-list'; import JwtUrlForm from '../../../components/institutional/jwt-url-form'; +import { + MetaMetricsEventCategory, + MetaMetricsEventName, +} from '../../../../shared/constants/metametrics'; import PulseLoader from '../../../components/ui/pulse-loader/pulse-loader'; const CustodyPage = () => { @@ -141,8 +145,8 @@ const CustodyPage = () => { setCurrentJwt(jwtListValue[0] || ''); setJwtList(jwtListValue); trackEvent({ - category: 'MMI', - event: 'Custodian Selected', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodianSelected, properties: { custodian: custodian.name, }, @@ -192,8 +196,8 @@ const CustodyPage = () => { `Something went wrong connecting your custodian account. Error details: ${errorMessage}`, ); trackEvent({ - category: 'MMI', - event: 'Connect to custodian error', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodianConnectionFailed, properties: { custodian: selectedCustodianName, }, @@ -225,8 +229,8 @@ const CustodyPage = () => { setAccounts(accountsValue); trackEvent({ - category: 'MMI', - event: 'Connect to custodian', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodianConnected, properties: { custodian: selectedCustodianName, apiUrl, @@ -553,8 +557,8 @@ const CustodyPage = () => { ); trackEvent({ - category: 'MMI', - event: 'Custodial accounts connected', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodialAccountsConnected, properties: { custodian: selectedCustodianName, numberOfAccounts: Object.keys(selectedAccounts).length, @@ -588,8 +592,8 @@ const CustodyPage = () => { } trackEvent({ - category: 'MMI', - event: 'Connect to custodian cancel', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodianConnectionCanceled, properties: { custodian: selectedCustodianName, numberOfAccounts: Object.keys(selectedAccounts).length,