1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

[MMI] adds segment events to Metametrics constants (#19468)

* adds metametrics enums

* prettier

* adds necessary code fence

* edits events names and title cases them

* edits events names

* updates events according to segment-schema
This commit is contained in:
António Regadas 2023-07-18 14:55:37 +01:00 committed by GitHub
parent e105a6030e
commit f8bfb6cff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 64 additions and 34 deletions

View File

@ -583,10 +583,19 @@ export enum MetaMetricsEventName {
WalletSetupFailed = 'Wallet Setup Failed', WalletSetupFailed = 'Wallet Setup Failed',
WalletCreated = 'Wallet Created', WalletCreated = 'Wallet Created',
///: BEGIN:ONLY_INCLUDE_IN(build-mmi) ///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
UserClickedDeepLink = 'User Clicked Deeplink', DeeplinkClicked = 'Deeplink Clicked',
UserClickedConnectCustodialAccount = 'Clicked Connect Custodial Account', ConnectCustodialAccountClicked = 'Connect Custodial Account Clicked',
UserClickedPortfolioButton = 'Clicked Portfolio Button', MMIPortfolioButtonClicked = 'MMI Portfolio Button Clicked',
UserClickedCompliance = 'Clicked Compliance', 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 ///: END:ONLY_INCLUDE_IN
AccountDetailMenuOpened = 'Account Details Menu Opened', AccountDetailMenuOpened = 'Account Details Menu Opened',
BlockExplorerLinkClicked = 'Block Explorer Clicked', BlockExplorerLinkClicked = 'Block Explorer Clicked',

View File

@ -11,7 +11,12 @@ import {
shortenAddress, shortenAddress,
///: END:ONLY_INCLUDE_IN ///: END:ONLY_INCLUDE_IN
} from '../../../helpers/utils/util'; } 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 SiteOrigin from '../../ui/site-origin';
import Button from '../../ui/button'; import Button from '../../ui/button';
import ContractDetailsModal from '../modals/contract-details-modal/contract-details-modal'; import ContractDetailsModal from '../modals/contract-details-modal/contract-details-modal';
@ -121,8 +126,8 @@ export default class SignatureRequest extends PureComponent {
onDeepLinkFetched: () => undefined, onDeepLinkFetched: () => undefined,
onDeepLinkShown: () => { onDeepLinkShown: () => {
this.context.trackEvent({ this.context.trackEvent({
category: 'MMI', category: MetaMetricsEventCategory.MMI,
event: 'Show deeplink for signature', event: MetaMetricsEventName.SignatureDeeplinkDisplayed,
}); });
}, },
}); });

View File

@ -73,15 +73,15 @@ const EthOverview = ({ className, showAddress }) => {
const portfolioEvent = () => { const portfolioEvent = () => {
trackEvent({ trackEvent({
category: 'Navigation', category: MetaMetricsEventCategory.Navigation,
event: 'Clicked Portfolio Button', event: MetaMetricsEventName.MMIPortfolioButtonClicked,
}); });
}; };
const stakingEvent = () => { const stakingEvent = () => {
trackEvent({ trackEvent({
category: 'Navigation', category: MetaMetricsEventCategory.Navigation,
event: 'Clicked Stake Button', event: MetaMetricsEventName.MMIPortfolioButtonClicked,
}); });
}; };

View File

@ -70,7 +70,7 @@ const CustodyConfirmLink = ({ hideModal }) => {
trackEvent({ trackEvent({
category: MetaMetricsEventCategory.MMI, category: MetaMetricsEventCategory.MMI,
event: MetaMetricsEventName.UserClickedDeepLink, event: MetaMetricsEventName.DeeplinkClicked,
}); });
dispatch(mmiActions.setWaitForConfirmDeepLinkDialog(false)); dispatch(mmiActions.setWaitForConfirmDeepLinkDialog(false));
dispatch(hideModal()); dispatch(hideModal());

View File

@ -26,6 +26,10 @@ import {
TextAlign, TextAlign,
AlignItems, AlignItems,
} from '../../../helpers/constants/design-system'; } from '../../../helpers/constants/design-system';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
} from '../../../../shared/constants/metametrics';
const InteractiveReplacementTokenModal = () => { const InteractiveReplacementTokenModal = () => {
const t = useI18nContext(); const t = useI18nContext();
@ -55,8 +59,8 @@ const InteractiveReplacementTokenModal = () => {
}); });
trackEvent({ trackEvent({
category: 'MMI', category: MetaMetricsEventCategory.MMI,
event: 'User clicked refresh token link', event: MetaMetricsEventName.ComplianceButtonClicked,
}); });
}; };

View File

@ -298,7 +298,7 @@ export const AccountListMenu = ({ onClose }) => {
trackEvent({ trackEvent({
category: MetaMetricsEventCategory.Navigation, category: MetaMetricsEventCategory.Navigation,
event: event:
MetaMetricsEventName.UserClickedConnectCustodialAccount, MetaMetricsEventName.ConnectCustodialAccountClicked,
}); });
if (getEnvironmentType() === ENVIRONMENT_TYPE_POPUP) { if (getEnvironmentType() === ENVIRONMENT_TYPE_POPUP) {
global.platform.openExtensionInBrowser( global.platform.openExtensionInBrowser(

View File

@ -113,7 +113,7 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
onClick={() => { onClick={() => {
trackEvent({ trackEvent({
category: MetaMetricsEventCategory.Navigation, category: MetaMetricsEventCategory.Navigation,
event: MetaMetricsEventName.UserClickedPortfolioButton, event: MetaMetricsEventName.MMIPortfolioButtonClicked,
}); });
window.open(mmiPortfolioUrl, '_blank'); window.open(mmiPortfolioUrl, '_blank');
closeMenu(); closeMenu();

View File

@ -26,6 +26,10 @@ import {
Box, Box,
} from '../../../components/component-library'; } from '../../../components/component-library';
import { Text } from '../../../components/component-library/text/deprecated'; import { Text } from '../../../components/component-library/text/deprecated';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
} from '../../../../shared/constants/metametrics';
import { import {
complianceActivated, complianceActivated,
getInstitutionalConnectRequests, getInstitutionalConnectRequests,
@ -59,8 +63,8 @@ const ConfirmAddCustodianToken = () => {
} }
trackEvent({ trackEvent({
category: 'MMI', category: MetaMetricsEventCategory.MMI,
event: 'Custodian onboarding', event: MetaMetricsEventName.TokenAdded,
properties: { properties: {
actions: 'Custodian RPC request', actions: 'Custodian RPC request',
custodian: connectRequest.custodian, custodian: connectRequest.custodian,
@ -184,8 +188,8 @@ const ConfirmAddCustodianToken = () => {
); );
trackEvent({ trackEvent({
category: 'MMI', category: MetaMetricsEventCategory.MMI,
event: 'Custodian onboarding', event: MetaMetricsEventName.TokenAdded,
properties: { properties: {
actions: 'Custodian RPC cancel', actions: 'Custodian RPC cancel',
custodian: connectRequest.custodian, custodian: connectRequest.custodian,
@ -238,8 +242,8 @@ const ConfirmAddCustodianToken = () => {
); );
trackEvent({ trackEvent({
category: 'MMI', category: MetaMetricsEventCategory.MMI,
event: 'Custodian onboarding', event: MetaMetricsEventName.TokenAdded,
properties: { properties: {
actions: 'Custodian RPC confirm', actions: 'Custodian RPC confirm',
custodian: connectRequest.custodian, custodian: connectRequest.custodian,

View File

@ -21,6 +21,10 @@ import {
} from '../../../helpers/constants/design-system'; } from '../../../helpers/constants/design-system';
import Box from '../../../components/ui/box'; import Box from '../../../components/ui/box';
import { mmiActionsFactory } from '../../../store/institutional/institution-background'; import { mmiActionsFactory } from '../../../store/institutional/institution-background';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
} from '../../../../shared/constants/metametrics';
export default function ConfirmAddInstitutionalFeature({ history }) { export default function ConfirmAddInstitutionalFeature({ history }) {
const t = useI18nContext(); const t = useI18nContext();
@ -52,8 +56,8 @@ export default function ConfirmAddInstitutionalFeature({ history }) {
const sendEvent = ({ actions, service }) => { const sendEvent = ({ actions, service }) => {
trackEvent({ trackEvent({
category: 'MMI', category: MetaMetricsEventCategory.MMI,
event: 'Institutional feature connection', event: MetaMetricsEventName.InstitutionalFeatureConnected,
properties: { properties: {
actions, actions,
service, service,

View File

@ -44,6 +44,10 @@ import { getCurrentChainId, getSelectedAddress } from '../../../selectors';
import { getMMIConfiguration } from '../../../selectors/institutional/selectors'; import { getMMIConfiguration } from '../../../selectors/institutional/selectors';
import CustodyAccountList from '../connect-custody/account-list'; import CustodyAccountList from '../connect-custody/account-list';
import JwtUrlForm from '../../../components/institutional/jwt-url-form'; import JwtUrlForm from '../../../components/institutional/jwt-url-form';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
} from '../../../../shared/constants/metametrics';
import PulseLoader from '../../../components/ui/pulse-loader/pulse-loader'; import PulseLoader from '../../../components/ui/pulse-loader/pulse-loader';
const CustodyPage = () => { const CustodyPage = () => {
@ -141,8 +145,8 @@ const CustodyPage = () => {
setCurrentJwt(jwtListValue[0] || ''); setCurrentJwt(jwtListValue[0] || '');
setJwtList(jwtListValue); setJwtList(jwtListValue);
trackEvent({ trackEvent({
category: 'MMI', category: MetaMetricsEventCategory.MMI,
event: 'Custodian Selected', event: MetaMetricsEventName.CustodianSelected,
properties: { properties: {
custodian: custodian.name, custodian: custodian.name,
}, },
@ -192,8 +196,8 @@ const CustodyPage = () => {
`Something went wrong connecting your custodian account. Error details: ${errorMessage}`, `Something went wrong connecting your custodian account. Error details: ${errorMessage}`,
); );
trackEvent({ trackEvent({
category: 'MMI', category: MetaMetricsEventCategory.MMI,
event: 'Connect to custodian error', event: MetaMetricsEventName.CustodianConnectionFailed,
properties: { properties: {
custodian: selectedCustodianName, custodian: selectedCustodianName,
}, },
@ -225,8 +229,8 @@ const CustodyPage = () => {
setAccounts(accountsValue); setAccounts(accountsValue);
trackEvent({ trackEvent({
category: 'MMI', category: MetaMetricsEventCategory.MMI,
event: 'Connect to custodian', event: MetaMetricsEventName.CustodianConnected,
properties: { properties: {
custodian: selectedCustodianName, custodian: selectedCustodianName,
apiUrl, apiUrl,
@ -553,8 +557,8 @@ const CustodyPage = () => {
); );
trackEvent({ trackEvent({
category: 'MMI', category: MetaMetricsEventCategory.MMI,
event: 'Custodial accounts connected', event: MetaMetricsEventName.CustodialAccountsConnected,
properties: { properties: {
custodian: selectedCustodianName, custodian: selectedCustodianName,
numberOfAccounts: Object.keys(selectedAccounts).length, numberOfAccounts: Object.keys(selectedAccounts).length,
@ -588,8 +592,8 @@ const CustodyPage = () => {
} }
trackEvent({ trackEvent({
category: 'MMI', category: MetaMetricsEventCategory.MMI,
event: 'Connect to custodian cancel', event: MetaMetricsEventName.CustodianConnectionCanceled,
properties: { properties: {
custodian: selectedCustodianName, custodian: selectedCustodianName,
numberOfAccounts: Object.keys(selectedAccounts).length, numberOfAccounts: Object.keys(selectedAccounts).length,