From e8deec28bb0cdad7952209e7d52f1ce98391e4f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Oliv=C3=A9?= Date: Thu, 20 Jul 2023 16:29:16 +0200 Subject: [PATCH] Added back trackEvents to whats-new-popup (#20110) * Added back trackEvents to whats-new-popup * Renamed constants * Fixed code fences issue --- shared/constants/metametrics.ts | 2 ++ .../app/whats-new-popup/whats-new-popup.js | 27 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/shared/constants/metametrics.ts b/shared/constants/metametrics.ts index 9e7fdbe1f..1371a451d 100644 --- a/shared/constants/metametrics.ts +++ b/shared/constants/metametrics.ts @@ -586,6 +586,8 @@ export enum MetaMetricsEventName { DeeplinkClicked = 'Deeplink Clicked', ConnectCustodialAccountClicked = 'Connect Custodial Account Clicked', MMIPortfolioButtonClicked = 'MMI Portfolio Button Clicked', + PortfolioDashboardModalButtonClicked = 'Portfolio Dashboard Modal Button Clicked', + PortfolioDashboardModalOpened = 'Portfolio Dashboard Modal Opened', StakeButtonClicked = 'Stake Button Clicked', InteractiveReplacementTokenButtonClicked = 'Interactive Replacement Token Button Clicked', RefreshTokenListClicked = 'Refresh Token List Clicked', diff --git a/ui/components/app/whats-new-popup/whats-new-popup.js b/ui/components/app/whats-new-popup/whats-new-popup.js index 09e26129f..fb4ea7286 100644 --- a/ui/components/app/whats-new-popup/whats-new-popup.js +++ b/ui/components/app/whats-new-popup/whats-new-popup.js @@ -347,10 +347,26 @@ export default function WhatsNewPopup({ observer.observe(ref.current); }); + ///: BEGIN:ONLY_INCLUDE_IN(build-mmi) + trackEvent({ + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.MMIPortfolioDashboardModalOpen, + properties: { + action: 'Modal was opened', + }, + }); + ///: END:ONLY_INCLUDE_IN + return () => { observer.disconnect(); }; - }, [idRefMap, setSeenNotifications]); + }, [ + idRefMap, + setSeenNotifications, + ///: BEGIN:ONLY_INCLUDE_IN(build-mmi) + trackEvent, + ///: END:ONLY_INCLUDE_IN + ]); // Display the swaps notification with full image // Displays the NFTs & OpenSea notifications 18,19 with full image @@ -377,6 +393,15 @@ export default function WhatsNewPopup({ completed_all: true, }, }); + ///: BEGIN:ONLY_INCLUDE_IN(build-mmi) + trackEvent({ + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.MMIPortfolioDashboardModalButton, + properties: { + action: 'Button was clicked', + }, + }); + ///: END:ONLY_INCLUDE_IN onClose(); }} popoverRef={popoverRef}