forked from Charlie85270/tail-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_document.tsx
36 lines (35 loc) · 1.27 KB
/
_document.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import Document, { Html, Head, Main, NextScript } from 'next/document';
import { GA_TRACKING_ID } from '../lib/gtag';
export default class MyDocument extends Document {
render() {
return (
<Html lang="en">
<Head>
<script
data-ad-client="ca-pub-9198515375847190"
async
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"
></script>
{/* 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,
});
`,
}}
/>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}