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

chore: add new track events for enabling/disabling basic functionality #11088

Merged
merged 2 commits into from
Sep 6, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -41,6 +43,7 @@ interface Props {
}

const BasicFunctionalityModal = ({ route }: Props) => {
const { trackEvent } = useMetrics();
const { colors } = useTheme();
const styles = createStyles(colors);
const bottomSheetRef = useRef<BottomSheetRef>(null);
Expand Down Expand Up @@ -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 ||
Expand Down
8 changes: 8 additions & 0 deletions app/core/Analytics/MetaMetrics.events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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),
Expand Down
Loading