diff --git a/frontend/src/component/layout/Error/Error.tsx b/frontend/src/component/layout/Error/Error.tsx index 0ef91ab816..895e8ad59a 100644 --- a/frontend/src/component/layout/Error/Error.tsx +++ b/frontend/src/component/layout/Error/Error.tsx @@ -1,8 +1,9 @@ -import { VFC } from 'react'; +import { useEffect, VFC } from 'react'; import { useNavigate } from 'react-router-dom'; import { Box } from '@mui/material'; import { Dialogue } from 'component/common/Dialogue/Dialogue'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; +import { usePlausibleTracker } from 'hooks/usePlausibleTracker'; interface IErrorProps { error: Error; @@ -10,6 +11,20 @@ interface IErrorProps { export const Error: VFC = ({ error }) => { const navigate = useNavigate(); + const { trackEvent } = usePlausibleTracker(); + + useEffect(() => { + const { message, stack = 'unknown' } = error; + + trackEvent('unknown_ui_error', { + props: { + location: window?.location?.href || 'unknown', + message, + stack, + }, + }); + }, []); + return ( { const plausible = useContext(PlausibleContext);