From bad1c05607404327950732fc3e5d0c09257d55d2 Mon Sep 17 00:00:00 2001 From: Brendan Ryan Date: Mon, 16 Mar 2026 10:47:57 -0700 Subject: [PATCH] feat: add Google Analytics (gtag.js) via static HTML head --- .env.example | 1 + biome.json | 10 ++++++++++ vocs.config.ts => vocs.config.tsx | 15 +++++++++++++++ 3 files changed, 26 insertions(+) rename vocs.config.ts => vocs.config.tsx (97%) diff --git a/.env.example b/.env.example index f881cd6d..fa329d7d 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,7 @@ INDEXSUPPLY_API_KEY= SLACK_FEEDBACK_WEBHOOK= # e.g. https://hooks.slack.com/services/... VITE_BASE_URL= # e.g. https://docs.tempo.xyz +VITE_GA_MEASUREMENT_ID= VITE_POSTHOG_HOST= VITE_POSTHOG_KEY= VITE_TEMPO_ENV= # testnet|devnet|localnet diff --git a/biome.json b/biome.json index e0242fef..14375d27 100644 --- a/biome.json +++ b/biome.json @@ -59,6 +59,16 @@ ] }, "overrides": [ + { + "includes": ["vocs.config.tsx"], + "linter": { + "rules": { + "security": { + "noDangerouslySetInnerHtml": "off" + } + } + } + }, { "includes": ["env.d.ts"], "linter": { diff --git a/vocs.config.ts b/vocs.config.tsx similarity index 97% rename from vocs.config.ts rename to vocs.config.tsx index 9ebdd607..26678d9e 100644 --- a/vocs.config.ts +++ b/vocs.config.tsx @@ -1,6 +1,8 @@ import { Changelog, defineConfig, McpSource } from 'vocs/config' import { createFeedbackAdapter } from './src/lib/feedback-adapter' +const gaMeasurementId = process.env.VITE_GA_MEASUREMENT_ID + const baseUrl = (() => { if (URL.canParse(process.env.VITE_BASE_URL)) return process.env.VITE_BASE_URL // VERCEL_BRANCH_URL is the stable URL for the branch (e.g., next.docs.tempo.xyz) @@ -13,6 +15,19 @@ const baseUrl = (() => { })() export default defineConfig({ + head: gaMeasurementId ? ( + <> +