diff --git a/app/components/UI/Stake/Views/StakeInputView/StakeInputView.tsx b/app/components/UI/Stake/Views/StakeInputView/StakeInputView.tsx
index 39b0ca906ea..06fdb4ab6ba 100644
--- a/app/components/UI/Stake/Views/StakeInputView/StakeInputView.tsx
+++ b/app/components/UI/Stake/Views/StakeInputView/StakeInputView.tsx
@@ -19,7 +19,7 @@ import styleSheet from './StakeInputView.styles';
import useStakingInputHandlers from '../../hooks/useStakingInput';
import InputDisplay from '../../components/InputDisplay';
import { MetaMetricsEvents, useMetrics } from '../../../../hooks/useMetrics';
-import { withMetaMetrics } from '../../utils/withMetaMetrics';
+import { withMetaMetrics } from '../../utils/metaMetrics/withMetaMetrics';
const StakeInputView = () => {
const title = strings('stake.stake_eth');
@@ -54,15 +54,6 @@ const StakeInputView = () => {
navigation.navigate('StakeModals', {
screen: Routes.STAKING.MODALS.LEARN_MORE,
});
- trackEvent(
- createEventBuilder(MetaMetricsEvents.STAKE_LEARN_MORE_CLICKED)
- .addProperties({
- selected_provider: 'consensys',
- text: 'Tooltip Question Mark Trigger',
- location: 'Stake Input View'
- })
- .build()
- );
};
const handleStakePress = useCallback(() => {
@@ -78,12 +69,12 @@ const StakeInputView = () => {
});
trackEvent(
createEventBuilder(MetaMetricsEvents.REVIEW_STAKE_BUTTON_CLICKED)
- .addProperties({
- selected_provider: 'consensys',
- tokens_to_stake_native_value: amountEth,
- tokens_to_stake_usd_value: fiatAmount,
- })
- .build(),
+ .addProperties({
+ selected_provider: 'consensys',
+ tokens_to_stake_native_value: amountEth,
+ tokens_to_stake_usd_value: fiatAmount,
+ })
+ .build(),
);
}, [
amountEth,
@@ -94,7 +85,7 @@ const StakeInputView = () => {
annualRewardsFiat,
annualRewardRate,
trackEvent,
- createEventBuilder
+ createEventBuilder,
]);
const handleMaxButtonPress = () => {
@@ -152,7 +143,15 @@ const StakeInputView = () => {
diff --git a/app/components/UI/Stake/Views/StakeInputView/__snapshots__/StakeInputView.test.tsx.snap b/app/components/UI/Stake/Views/StakeInputView/__snapshots__/StakeInputView.test.tsx.snap
index 0193ba5abe1..fb47e1bf1c1 100644
--- a/app/components/UI/Stake/Views/StakeInputView/__snapshots__/StakeInputView.test.tsx.snap
+++ b/app/components/UI/Stake/Views/StakeInputView/__snapshots__/StakeInputView.test.tsx.snap
@@ -567,7 +567,7 @@ exports[`StakeInputView render matches snapshot 1`] = `
onPress={[Function]}
>
{
const title = strings('stake.unstake_eth');
@@ -69,14 +69,21 @@ const UnstakeInputView = () => {
});
trackEvent(
createEventBuilder(MetaMetricsEvents.REVIEW_UNSTAKE_BUTTON_CLICKED)
- .addProperties({
- selected_provider: 'consensys',
- tokens_to_stake_native_value: amountEth,
- tokens_to_stake_usd_value: fiatAmount,
- })
- .build(),
+ .addProperties({
+ selected_provider: 'consensys',
+ tokens_to_stake_native_value: amountEth,
+ tokens_to_stake_usd_value: fiatAmount,
+ })
+ .build(),
);
- }, [amountEth, amountWei, createEventBuilder, fiatAmount, navigation, trackEvent]);
+ }, [
+ amountEth,
+ amountWei,
+ createEventBuilder,
+ fiatAmount,
+ navigation,
+ trackEvent,
+ ]);
return (
diff --git a/app/components/UI/Stake/components/LearnMoreModal/index.tsx b/app/components/UI/Stake/components/LearnMoreModal/index.tsx
index b33f5aeba49..eb321f8d238 100644
--- a/app/components/UI/Stake/components/LearnMoreModal/index.tsx
+++ b/app/components/UI/Stake/components/LearnMoreModal/index.tsx
@@ -17,7 +17,8 @@ import { useNavigation } from '@react-navigation/native';
import { strings } from '../../../../../../locales/i18n';
import { POOLED_STAKING_FAQ_URL } from '../../constants';
import createLearnMoreModalStyles from './LearnMoreModal.styles';
-import { MetaMetricsEvents, useMetrics } from '../../../../hooks/useMetrics';
+import { MetaMetricsEvents } from '../../../../hooks/useMetrics';
+import { withMetaMetrics } from '../../utils/metaMetrics/withMetaMetrics';
const styles = createLearnMoreModalStyles();
@@ -42,12 +43,21 @@ const LearnMoreModal = () => {
const sheetRef = useRef(null);
const navigation = useNavigation();
- const { trackEvent, createEventBuilder } = useMetrics();
const handleClose = () => {
sheetRef.current?.onCloseBottomSheet();
};
+ const handleLearnMoreBrowserRedirect = () => {
+ // Take to the faq page
+ navigation.navigate('Webview', {
+ screen: 'SimpleWebview',
+ params: {
+ url: POOLED_STAKING_FAQ_URL,
+ },
+ });
+ };
+
return (
@@ -86,23 +96,14 @@ const LearnMoreModal = () => {
{isLoadingEarningsData ? (
diff --git a/app/components/UI/Stake/utils/metaMetrics/tooltipMetaMetricsUtils.ts b/app/components/UI/Stake/utils/metaMetrics/tooltipMetaMetricsUtils.ts
new file mode 100644
index 00000000000..e28a9431c92
--- /dev/null
+++ b/app/components/UI/Stake/utils/metaMetrics/tooltipMetaMetricsUtils.ts
@@ -0,0 +1,23 @@
+import { MetricsEventBuilder } from '../../../../../core/Analytics/MetricsEventBuilder';
+import { MetaMetricsEvents } from '../../../../hooks/useMetrics';
+
+export const getTooltipMetricProperties = (
+ location: string,
+ tooltipName: string,
+) => ({
+ selected_provider: 'consensys',
+ text: 'Tooltip Opened',
+ location,
+ tooltip_name: tooltipName,
+});
+
+export const createTooltipOpenedEvent = (
+ location: string,
+ tooltipName: string,
+) => {
+ const createEventBuilder = MetricsEventBuilder.createEventBuilder;
+
+ return createEventBuilder(MetaMetricsEvents.TOOLTIP_OPENED)
+ .addProperties(getTooltipMetricProperties(location, tooltipName))
+ .build();
+};
diff --git a/app/components/UI/Stake/utils/withMetaMetrics.ts b/app/components/UI/Stake/utils/metaMetrics/withMetaMetrics.ts
similarity index 86%
rename from app/components/UI/Stake/utils/withMetaMetrics.ts
rename to app/components/UI/Stake/utils/metaMetrics/withMetaMetrics.ts
index ba80f75e5e2..ba828b96577 100644
--- a/app/components/UI/Stake/utils/withMetaMetrics.ts
+++ b/app/components/UI/Stake/utils/metaMetrics/withMetaMetrics.ts
@@ -1,9 +1,9 @@
import {
IMetaMetricsEvent,
JsonMap,
-} from '../../../../core/Analytics/MetaMetrics.types';
-import { MetricsEventBuilder } from '../../../../core/Analytics/MetricsEventBuilder';
-import { MetaMetrics } from '../../../../core/Analytics';
+} from '../../../../../core/Analytics/MetaMetrics.types';
+import { MetricsEventBuilder } from '../../../../../core/Analytics/MetricsEventBuilder';
+import { MetaMetrics } from '../../../../../core/Analytics';
interface WithMetaMetricsEvent {
event: IMetaMetricsEvent;
diff --git a/app/core/Analytics/MetaMetrics.events.ts b/app/core/Analytics/MetaMetrics.events.ts
index 70744672558..1925896b1fc 100644
--- a/app/core/Analytics/MetaMetrics.events.ts
+++ b/app/core/Analytics/MetaMetrics.events.ts
@@ -391,6 +391,9 @@ enum EVENT_NAME {
// Connection
CONNECTION_DROPPED = 'Connection dropped',
CONNECTION_RESTORED = 'Connection restored',
+
+ // Tooltip
+ TOOLTIP_OPENED = 'Tooltip Opened',
}
enum ACTIONS {
@@ -556,6 +559,7 @@ const events = {
BROWSER_RELOAD: generateOpt(EVENT_NAME.BROWSER_RELOAD),
BROWSER_ADD_FAVORITES: generateOpt(EVENT_NAME.BROWSER_ADD_FAVORITES),
DAPP_VIEWED: generateOpt(EVENT_NAME.DAPP_VIEWED),
+ TOOLTIP_OPENED: generateOpt(EVENT_NAME.TOOLTIP_OPENED),
// Security & Privacy Settings
VIEW_SECURITY_SETTINGS: generateOpt(EVENT_NAME.VIEW_SECURITY_SETTINGS),
BASIC_FUNCTIONALITY_ENABLED: generateOpt(