Skip to content

Commit ab22602

Browse files
Move speedinsights and analytics to /pages instead of /app (#624)
* feat(analytics and speed insight): added vercel analytics and speed insights * fix(analytics speedinsights): move analytics and speedinsights to pages --------- Co-authored-by: Christian Tran <ctran4347@gmail.com>
1 parent a9b95ce commit ab22602

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pages/_app.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { AuthContextProvider } from '@context/AuthContext';
44
import { ColorProvider } from '@context/ColorContext';
55
import { MenuContextProvider } from '@context/MenuContext';
66
import { CacheProvider, EmotionCache } from '@emotion/react';
7+
import { Analytics } from '@vercel/analytics/next';
8+
import { SpeedInsights } from '@vercel/speed-insights/next';
79
import CssBaseline from '@mui/material/CssBaseline';
810
import { NavBar } from '@src/components/NavBar';
911
import createEmotionCache from '@src/createEmotionCache';
@@ -41,6 +43,8 @@ const MyApp = ({
4143
<AlertBar />
4244
</MenuContextProvider>
4345
{<Component {...pageProps} />}
46+
<Analytics />
47+
<SpeedInsights />
4448
{/* <Copyright /> */}
4549
</AuthContextProvider>
4650
</AlertContextProvider>

pages/_document.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ MyDocument.getInitialProps = async (ctx: any) => {
6767
ctx.renderPage = () =>
6868
originalRenderPage({
6969
enhanceApp: (App: any) =>
70-
function EnhanceApp(props: any) {
70+
(function EnhanceApp(props: any) {
7171
return <App emotionCache={cache} {...props} />;
72-
},
72+
}),
7373
});
7474

7575
const initialProps = await Document.getInitialProps(ctx);

0 commit comments

Comments
 (0)