Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MMI] adds segment events to Metametrics constants #19468

Merged
merged 8 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions shared/constants/metametrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
});
},
});
Expand Down
8 changes: 4 additions & 4 deletions ui/components/app/wallet-overview/eth-overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const CustodyConfirmLink = () => {

trackEvent({
category: MetaMetricsEventCategory.MMI,
event: MetaMetricsEventName.UserClickedDeepLink,
event: MetaMetricsEventName.DeeplinkClicked,
});
dispatch(mmiActions.setWaitForConfirmDeepLinkDialog(false));
dispatch(hideModal());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ import {
TextAlign,
AlignItems,
} from '../../../helpers/constants/design-system';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
} from '../../../../shared/constants/metametrics';

const InteractiveReplacementTokenModal = () => {
const t = useI18nContext();
Expand Down Expand Up @@ -55,8 +59,8 @@ const InteractiveReplacementTokenModal = () => {
});

trackEvent({
category: 'MMI',
event: 'User clicked refresh token link',
category: MetaMetricsEventCategory.MMI,
event: MetaMetricsEventName.ComplianceButtonClicked,
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion ui/components/multichain/global-menu/global-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => {
onClick={() => {
trackEvent({
category: MetaMetricsEventCategory.Navigation,
event: MetaMetricsEventName.UserClickedPortfolioButton,
event: MetaMetricsEventName.MMIPortfolioButtonClicked,
});
window.open(mmiPortfolioUrl, '_blank');
closeMenu();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ import {
BUTTON_VARIANT,
Box,
} from '../../../components/component-library';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
} from '../../../../shared/constants/metametrics';
import {
complianceActivated,
getInstitutionalConnectRequests,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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,
Expand Down
24 changes: 14 additions & 10 deletions ui/pages/institutional/custody/custody.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ import { getCurrentChainId } 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 = () => {
Expand Down Expand Up @@ -140,8 +144,8 @@ const CustodyPage = () => {
setCurrentJwt(jwtListValue[0] || '');
setJwtList(jwtListValue);
trackEvent({
category: 'MMI',
event: 'Custodian Selected',
category: MetaMetricsEventCategory.MMI,
event: MetaMetricsEventName.CustodianSelected,
properties: {
custodian: custodian.name,
},
Expand Down Expand Up @@ -191,8 +195,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,
},
Expand Down Expand Up @@ -224,8 +228,8 @@ const CustodyPage = () => {

setAccounts(accountsValue);
trackEvent({
category: 'MMI',
event: 'Connect to custodian',
category: MetaMetricsEventCategory.MMI,
event: MetaMetricsEventName.CustodianConnected,
properties: {
custodian: selectedCustodianName,
apiUrl,
Expand Down Expand Up @@ -551,8 +555,8 @@ const CustodyPage = () => {
);

trackEvent({
category: 'MMI',
event: 'Custodial accounts connected',
category: MetaMetricsEventCategory.MMI,
event: MetaMetricsEventName.CustodialAccountsConnected,
properties: {
custodian: selectedCustodianName,
numberOfAccounts: Object.keys(selectedAccounts).length,
Expand Down Expand Up @@ -586,8 +590,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,
Expand Down