-
Notifications
You must be signed in to change notification settings - Fork 0
/
_document.tsx
44 lines (37 loc) · 981 Bytes
/
_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
37
38
39
40
41
42
43
44
import Document, {
DocumentContext,
DocumentInitialProps,
Html,
Head,
Main,
NextScript,
} from "next/document"
import Script from "next/script"
class MyDocument extends Document {
static async getInitialProps(
ctx: DocumentContext
): Promise<DocumentInitialProps> {
const initialProps = await Document.getInitialProps(ctx)
return initialProps
}
render() {
return (
<Html lang="en-US">
<Head />
<body>
<Main />
<NextScript />
{/* Only load the tracker script in environments where NEXT_PUBLIC_TINYBIRD_TRACKER_PROXY is defined. */}
{process.env.NEXT_PUBLIC_TINYBIRD_TRACKER_PROXY && (
<Script
src="https://unpkg.com/@tinybirdco/flock.js"
data-proxy={process.env.NEXT_PUBLIC_TINYBIRD_TRACKER_PROXY}
strategy="beforeInteractive"
/>
)}
</body>
</Html>
)
}
}
export default MyDocument