diff --git a/app/components/UI/BasicFunctionality/BasicFunctionalityModal/BasicFunctionalityModal.tsx b/app/components/UI/BasicFunctionality/BasicFunctionalityModal/BasicFunctionalityModal.tsx index 300cd8a1c48..99642d1249e 100644 --- a/app/components/UI/BasicFunctionality/BasicFunctionalityModal/BasicFunctionalityModal.tsx +++ b/app/components/UI/BasicFunctionality/BasicFunctionalityModal/BasicFunctionalityModal.tsx @@ -30,7 +30,9 @@ import { asyncAlert, requestPushNotificationsPermission, } from '../../../../util/notifications'; +import { MetaMetricsEvents } from '../../../../core/Analytics'; import { useEnableNotifications } from '../../../../util/notifications/hooks/useNotifications'; +import { useMetrics } from '../../../hooks/useMetrics'; interface Props { route: { @@ -41,6 +43,7 @@ interface Props { } const BasicFunctionalityModal = ({ route }: Props) => { + const { trackEvent } = useMetrics(); const { colors } = useTheme(); const styles = createStyles(colors); const bottomSheetRef = useRef(null); @@ -68,9 +71,14 @@ const BasicFunctionalityModal = ({ route }: Props) => { }, [enableNotifications]); const closeBottomSheet = async () => { - bottomSheetRef.current?.onCloseBottomSheet(() => - dispatch(toggleBasicFunctionality(!isEnabled)), - ); + bottomSheetRef.current?.onCloseBottomSheet(() => { + dispatch(toggleBasicFunctionality(!isEnabled)); + trackEvent( + !isEnabled + ? MetaMetricsEvents.BASIC_FUNCTIONALITY_ENABLED + : MetaMetricsEvents.BASIC_FUNCTIONALITY_DISABLED, + ); + }); if ( route.params.caller === Routes.SETTINGS.NOTIFICATIONS || diff --git a/app/core/Analytics/MetaMetrics.events.ts b/app/core/Analytics/MetaMetrics.events.ts index bfec76362b4..f8da8d5d757 100644 --- a/app/core/Analytics/MetaMetrics.events.ts +++ b/app/core/Analytics/MetaMetrics.events.ts @@ -159,6 +159,8 @@ enum EVENT_NAME { // Security & Privacy Settings VIEW_SECURITY_SETTINGS = 'Views Security & Privacy', + BASIC_FUNCTIONALITY_ENABLED = 'Basic Functionality Enabled', + BASIC_FUNCTIONALITY_DISABLED = 'Basic Functionality Disabled', // Settings SETTINGS_VIEWED = 'Settings Viewed', @@ -576,6 +578,12 @@ const events = { DAPP_VIEWED: generateOpt(EVENT_NAME.DAPP_VIEWED), // Security & Privacy Settings VIEW_SECURITY_SETTINGS: generateOpt(EVENT_NAME.VIEW_SECURITY_SETTINGS), + BASIC_FUNCTIONALITY_ENABLED: generateOpt( + EVENT_NAME.BASIC_FUNCTIONALITY_ENABLED, + ), + BASIC_FUNCTIONALITY_DISABLED: generateOpt( + EVENT_NAME.BASIC_FUNCTIONALITY_DISABLED, + ), // Reveal SRP REVEAL_SRP_CTA: generateOpt(EVENT_NAME.REVEAL_SRP_CTA), REVEAL_SRP_SCREEN: generateOpt(EVENT_NAME.REVEAL_SRP_SCREEN),