analytics only in production

This commit is contained in:
Matthias Kretschmann 2024-04-06 18:34:43 +01:00
parent 979e2361fb
commit 183e92af7d
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 10 additions and 6 deletions

View File

@ -2,7 +2,7 @@ import type { Metadata } from 'next'
import '@/styles/globals.css'
import '@/styles/loading-ui.css'
import Script from 'next/script'
import { title, description, font, liveUrl } from '@/constants'
import { title, description, font, liveUrl, isProduction } from '@/constants'
export const metadata: Metadata = {
title,
@ -19,11 +19,13 @@ export default function RootLayout({
return (
<html lang="en">
<head>
<Script
async
src="https://a.kretschmann.io/script.js"
data-website-id="6565eff1-a1c8-4b3e-a6c4-08ecb00b06ab"
/>
{isProduction ? (
<Script
async
src="https://a.kretschmann.io/script.js"
data-website-id="6565eff1-a1c8-4b3e-a6c4-08ecb00b06ab"
/>
) : null}
</head>
<body className={font.variable}>{children}</body>
</html>

View File

@ -21,3 +21,5 @@ export const font = Hanken_Grotesk({
subsets: ['latin'],
variable: '--font-hanken-grotesk'
})
export const isProduction = process.env.NODE_ENV === 'production'