angrybeanie-front-end/pages/_document.js

44 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-02-04 14:27:14 +11:00
import Document, { Html, Head, Main, NextScript } from 'next/document';
2020-12-06 21:49:37 +11:00
import React from 'react';
2021-02-04 14:27:14 +11:00
import { Fragment } from 'react'
import { GA_TRACKING_ID } from '../lib/gtag'
2020-12-06 21:49:37 +11:00
class CustomDocument extends Document {
render() {
return (
2021-02-04 14:27:14 +11:00
<Html lang="en">
2020-12-06 21:49:37 +11:00
<Head>
2021-02-04 14:27:14 +11:00
<Fragment>
{/* Global Site Tag (gtag.js) - Google Analytics */}
<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,
});
console.log("Page View")*/
`,
}}
/>
</Fragment>
2020-12-06 21:49:37 +11:00
<link href="https://fonts.googleapis.com/css?family=Cabin|Jaldi" rel="stylesheet" />
</Head>
<body>
<Main />
<NextScript />
</body>
2021-02-04 14:27:14 +11:00
</Html>
2020-12-06 21:49:37 +11:00
);
}
}
export default CustomDocument;