0

As the title says, I don't know how to properly install the code in this project...

This is my Google Analytics code:

<script async src="https://www.googletagmanager.com/gtag/js?id=G-15JT9MB1MV"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-15JT9MB1MV');
</script>

This is my '_app.jsx' file located in the src/pages folder.

import 'styles/globals.css'
import { Provider as ConnectionProvider } from 'context/connect'
import { useRouter } from 'next/router'
import Sidebar from 'components/Sidebar';
import Head from 'next/head';
import { mainConfig } from 'config/config';

function MyApp({ Component, pageProps }) {
  const router = useRouter();
  return <ConnectionProvider>
    <Head>
      <title>{mainConfig.nameApp}</title>      
      <meta name="viewport" content="initial-scale=1.0, width=device-width" />
      <link rel="shortcut icon" href="/favicon.ico" />  
    </Head>
    {router.pathname.includes('rooms') ? (
      <div className="flex">
        <Sidebar />
        <div className="overflow-y-auto w-full">
          <Component {...pageProps} />
        </div>
      </div>
    ) : <Component {...pageProps} />}
  </ConnectionProvider>
}

export default MyApp;

0

Browse other questions tagged or ask your own question.