From 7e59ce8d630cf866316680901d5815334950928a Mon Sep 17 00:00:00 2001 From: Kevin Ge Date: Tue, 10 Oct 2023 15:52:48 -0500 Subject: [PATCH] feat: add gtag script for analytics --- src/pages/_app.tsx | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index a9a052f7f..3981628fa 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -8,9 +8,9 @@ import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import { Analytics } from '@vercel/analytics/react'; import { AnimateSharedLayout } from 'framer-motion'; import { type AppType, AppProps } from 'next/app'; -// import type { AppProps } from 'next/app'; import Head from 'next/head'; import { Router } from 'next/router'; +import Script from 'next/script'; import { type Session } from 'next-auth'; import { SessionProvider, useSession } from 'next-auth/react'; import NProgress from 'nprogress'; //nprogress module @@ -18,15 +18,20 @@ import { FC, useEffect, useState } from 'react'; import { ToastContainer } from 'react-toastify'; import Layout from '@/components/home/Layout'; +import { env } from '@/env/client.mjs'; +import ScreenSizeWarnModal from '@/shared/ScreenSizeWarnModal'; import 'nprogress/nprogress.css'; //styles of nprogress +import { getBaseUrl, trpc } from '../utils/trpc'; + +import type { NextComponentType } from 'next'; //Import Component type + // Binding events NProgress.configure({ showSpinner: false }); Router.events.on('routeChangeStart', () => NProgress.start()); Router.events.on('routeChangeComplete', () => NProgress.done()); Router.events.on('routeChangeError', () => NProgress.done()); -import { getBaseUrl, trpc } from '../utils/trpc'; const theme = createTheme({ typography: { allVariants: { @@ -50,12 +55,6 @@ const theme = createTheme({ ].join(','), }, }); - -import { env } from '@/env/client.mjs'; -import ScreenSizeWarnModal from '@/shared/ScreenSizeWarnModal'; - -import type { NextComponentType } from 'next'; //Import Component type - //Add custom appProp type then use union to add it type CustomAppProps = AppProps & { Component: NextComponentType & { auth?: boolean }; // add auth type @@ -116,6 +115,17 @@ const NebulaApp: AppType<{ session: Session | null }> = ({ /> )} + + setHasWarned(true)}