11import { FC } from 'react' ;
22import type { AppProps } from 'next/app' ;
3+ import Script from 'next/script' ;
34import { appWithTranslation } from 'next-i18next' ;
45import { extendTheme , LinkProps , theme as chakraTheme } from '@chakra-ui/react' ;
56import { mode } from '@chakra-ui/theme-tools' ;
@@ -10,6 +11,7 @@ import {
1011 ExtendComponents ,
1112 handlePushRoute ,
1213 Link ,
14+ useGoogleAnalytics ,
1315} from '@guild-docs/client' ;
1416import { FooterExtended , Header , Subheader } from '@theguild/components' ;
1517import type { LinkProps as NextLinkProps } from 'next/link' ;
@@ -81,6 +83,7 @@ const mdxRoutes = { data: serializedMdx && JSON.parse(serializedMdx) };
8183
8284const AppContent : FC < AppProps > = appProps => {
8385 const { Component, pageProps, router } = appProps ;
86+ const analytics = useGoogleAnalytics ( { router, trackingId : "G-TPQZLLF5T5" } ) ;
8487 const isDocs = router . asPath . startsWith ( '/docs' ) ;
8588
8689 return (
@@ -126,6 +129,8 @@ const AppContent: FC<AppProps> = appProps => {
126129 rel : 'noopener noreferrer' ,
127130 } }
128131 />
132+ < Script { ...analytics . loadScriptProps } />
133+ < Script { ...analytics . configScriptProps } />
129134 { isDocs ? (
130135 < DocsPage appProps = { appProps } accentColor = { accentColor } mdxRoutes = { mdxRoutes } />
131136 ) : (
0 commit comments