Skip to content

Commit

Permalink
add analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
thewilloftheshadow committed Nov 15, 2024
1 parent d5d1488 commit 309db77
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
34 changes: 34 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions website/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { RootProvider } from "fumadocs-ui/provider"
import { Rubik } from "next/font/google"
import type { ReactNode } from "react"
import { baseUrl, createMetadata } from "./og/[...slug]/metadata"
import Script from "next/script"
import { env } from "~/env.mjs"

const rubik = Rubik({
subsets: ["latin"],
Expand All @@ -25,6 +27,13 @@ export default function Layout({ children }: { children: ReactNode }) {
<body>
<RootProvider>{children}</RootProvider>
</body>
{env.NODE_ENV === "production" ? (
<Script
defer
src="https://stats.b1.buape.com/script.js"
data-website-id="c864c489-8576-427a-b229-6ffac6fc1c33"
/>
) : null}
</html>
)
}
18 changes: 18 additions & 0 deletions website/env.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { createEnv } from "@t3-oss/env-nextjs"
import { z } from "zod"

export const env = createEnv({
extends: [],
shared: {},
server: {
NODE_ENV: z.enum(["development", "production", "test"]).default("development"),
},
client: {},
runtimeEnv: {
NODE_ENV: process.env.NODE_ENV,
},
skipValidation:
!!process.env.CI ||
!!process.env.SKIP_ENV_VALIDATION ||
process.env.npm_lifecycle_event === "lint"
})
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"web:export": "sh ./copy-api.sh && next export"
},
"dependencies": {
"@t3-oss/env-nextjs": "0.11.1",
"class-variance-authority": "0.7.0",
"fumadocs-core": "13.4.10",
"fumadocs-mdx": "10.0.2",
Expand Down

0 comments on commit 309db77

Please sign in to comment.