diff --git a/app/root.tsx b/app/root.tsx index f1b0dfd6c..b26c1352f 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -132,7 +132,7 @@ function Document({ useChangeLanguage(locale); usePreloadTranslation(); - useTrackPageView(); + useTrackPageView(data); return ( @@ -186,9 +186,8 @@ function usePreloadTranslation() { }, []); } -function useTrackPageView() { +function useTrackPageView(data?: RootLoaderData) { const location = useLocation(); - const data = useLoaderData(); React.useEffect(() => { if (data?.gtmId) {