mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-08 06:37:26 -05:00
60 lines
1.4 KiB
TypeScript
60 lines
1.4 KiB
TypeScript
import { ColorModeScript } from "@chakra-ui/react";
|
|
import Document, {
|
|
DocumentContext,
|
|
Head,
|
|
Html,
|
|
Main,
|
|
NextScript,
|
|
} from "next/document";
|
|
|
|
const GA_TRACKING_ID = "UA-163861331-1";
|
|
|
|
class MyDocument extends Document {
|
|
static async getInitialProps(ctx: DocumentContext) {
|
|
const initialProps = await Document.getInitialProps(ctx);
|
|
|
|
return initialProps;
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<Html>
|
|
<Head>
|
|
<link
|
|
href="https://fonts.googleapis.com/css2?family=Rubik&display=swap"
|
|
rel="stylesheet"
|
|
></link>
|
|
{/* Global Site Tag (gtag.js) - Google Analytics */}
|
|
{process.env.NODE_ENV === "production" && (
|
|
<>
|
|
<script
|
|
async
|
|
src={`https://www.googletagmanager.com/gtag/js?id=${GA_TRACKING_ID}`}
|
|
/>
|
|
<script
|
|
dangerouslySetInnerHTML={{
|
|
__html: `
|
|
window.dataLayer = window.dataLayer || [];
|
|
function gtag(){dataLayer.push(arguments);}
|
|
gtag('js', new Date());
|
|
gtag('config', '${GA_TRACKING_ID}', {
|
|
page_path: window.location.pathname,
|
|
});
|
|
`,
|
|
}}
|
|
/>
|
|
</>
|
|
)}
|
|
</Head>
|
|
<body>
|
|
<ColorModeScript />
|
|
<Main />
|
|
<NextScript />
|
|
</body>
|
|
</Html>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default MyDocument;
|