|
1 | 1 | import { defineConfig } from "vitepress"; |
2 | 2 | import { withPwa } from "@vite-pwa/vitepress"; |
3 | 3 |
|
| 4 | +const getAnalyticsScripts = () => { |
| 5 | + if (process.env.NODE_ENV === "development") { |
| 6 | + return []; |
| 7 | + } |
| 8 | + |
| 9 | + return [ |
| 10 | + [ |
| 11 | + "script", |
| 12 | + { |
| 13 | + defer: "true", |
| 14 | + "data-website-id": "3987279b-d6de-4294-bb20-b971a8ba6997", |
| 15 | + src: "https://umami.zeeland.top/script.js", |
| 16 | + }, |
| 17 | + ] as [string, Record<string, string>], |
| 18 | + [ |
| 19 | + "script", |
| 20 | + { |
| 21 | + async: "true", |
| 22 | + src: "https://www.googletagmanager.com/gtag/js?id=G-KLE8HJYSSL", |
| 23 | + }, |
| 24 | + ] as [string, Record<string, string>], |
| 25 | + [ |
| 26 | + "script", |
| 27 | + {}, |
| 28 | + `window.dataLayer = window.dataLayer || []; |
| 29 | + function gtag(){dataLayer.push(arguments);} |
| 30 | + gtag('js', new Date()); |
| 31 | + gtag('config', 'G-KLE8HJYSSL');`, |
| 32 | + ] as [string, Record<string, string>, string], |
| 33 | + ]; |
| 34 | +}; |
| 35 | + |
4 | 36 | export default withPwa( |
5 | 37 | defineConfig({ |
6 | 38 | title: "P3G", |
7 | 39 | description: "P3G Docs", |
8 | 40 | head: [ |
| 41 | + ...getAnalyticsScripts(), |
9 | 42 | ["link", { rel: "icon", href: "/logo.ico" }], |
10 | 43 | ["meta", { property: "og:title", content: "P3G" }], |
11 | 44 | [ |
|
0 commit comments