mocksaml/pages/_app.tsx

22 lines
542 B
TypeScript
Raw Normal View History

2022-02-22 06:14:12 +00:00
import Layout from 'components/Layout';
import type { AppProps } from 'next/app';
2022-03-01 00:50:36 +00:00
import { useEffect } from 'react';
import TagManager from 'react-gtm-module';
import 'styles/globals.css';
2022-01-08 15:11:13 +00:00
function MyApp({ Component, pageProps }: AppProps) {
2022-03-01 00:50:36 +00:00
useEffect(() => {
if (process.env.NEXT_PUBLIC_GTM_ID && process.env.NEXT_PUBLIC_GTM_ID.length > 0) {
2022-03-01 00:50:36 +00:00
TagManager.initialize({ gtmId: process.env.NEXT_PUBLIC_GTM_ID });
}
}, []);
2022-02-17 06:05:50 +00:00
return (
2022-02-18 08:56:42 +00:00
<Layout>
<Component {...pageProps} />
</Layout>
);
2022-01-08 15:11:13 +00:00
}
2022-02-18 08:56:42 +00:00
export default MyApp;