diff --git a/src/CONST/index.ts b/src/CONST/index.ts index edb078be017d..b682da76a5bb 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -1685,6 +1685,7 @@ const CONST = { SPAN_OPEN_SEARCH_ROUTER: 'ManualOpenSearchRouter', SPAN_OPEN_CREATE_EXPENSE: 'ManualOpenCreateExpense', SPAN_SEND_MESSAGE: 'ManualSendMessage', + SPAN_NOT_FOUND_PAGE: 'ManualNotFoundPage', SPAN_SKELETON: 'ManualSkeleton', SPAN_BOOTSPLASH: { ROOT: 'BootsplashVisible', diff --git a/src/components/BlockingViews/BlockingView.tsx b/src/components/BlockingViews/BlockingView.tsx index 70f03da986df..68d1ff21c87c 100644 --- a/src/components/BlockingViews/BlockingView.tsx +++ b/src/components/BlockingViews/BlockingView.tsx @@ -12,6 +12,7 @@ import Text from '@components/Text'; import useBottomSafeSafeAreaPaddingStyle from '@hooks/useBottomSafeSafeAreaPaddingStyle'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; +import useAbsentPageSpan from '@libs/telemetry/useAbsentPageSpan'; import variables from '@styles/variables'; import type {TranslationPaths} from '@src/languages/types'; import BlockingViewSubtitle from './BlockingViewSubtitle'; @@ -124,6 +125,8 @@ function BlockingView({ ); const containerStyle = useBottomSafeSafeAreaPaddingStyle({addBottomSafeAreaPadding, addOfflineIndicatorBottomSafeAreaPadding, style: containerStyleProp}); + useAbsentPageSpan(); + return ( { + let isDeeplink = false; + let currentUrl = ''; + + if (Platform.OS === 'web') { + currentUrl = window.location.href; + isDeeplink = currentUrl === initialURL; + } else { + isDeeplink = !!initialURL; + currentUrl = Navigation.getActiveRoute() || ''; + } + + const NAVIGATION_SOURCE = isDeeplink ? 'deeplink' : 'button'; + + startSpan(CONST.TELEMETRY.SPAN_NOT_FOUND_PAGE, { + name: CONST.TELEMETRY.SPAN_NOT_FOUND_PAGE, + op: CONST.TELEMETRY.SPAN_NOT_FOUND_PAGE, + attributes: { + url: currentUrl, + navigationSource: NAVIGATION_SOURCE, + }, + }); + + endSpan(CONST.TELEMETRY.SPAN_NOT_FOUND_PAGE); + }, [initialURL]); +} diff --git a/src/pages/ErrorPage/NotFoundPage.tsx b/src/pages/ErrorPage/NotFoundPage.tsx index 2917683da298..6eb84806f33e 100644 --- a/src/pages/ErrorPage/NotFoundPage.tsx +++ b/src/pages/ErrorPage/NotFoundPage.tsx @@ -5,6 +5,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import useOnyx from '@hooks/useOnyx'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import Navigation from '@libs/Navigation/Navigation'; +import useAbsentPageSpan from '@libs/telemetry/useAbsentPageSpan'; import ONYXKEYS from '@src/ONYXKEYS'; type NotFoundPageProps = { @@ -19,7 +20,9 @@ function NotFoundPage({onBackButtonPress = () => Navigation.goBack(), isReportRe // eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth const {isSmallScreenWidth} = useResponsiveLayout(); const topmostReportId = Navigation.getTopmostReportId(); - const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${topmostReportId}`); + const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${topmostReportId}`, {canBeMissing: true}); + + useAbsentPageSpan(); return (