feat(site): PostHog 로 방문을 집계한다 - #105
Merged
Merged
Conversation
키와 프록시 주소는 빌드 변수 `POSTHOG_KEY` · `POSTHOG_HOST` 로 받는다(`astro:env` 스키마) — Workers Builds 의 프로덕션 빌드 변수에만 넣는다. 하나라도 없는 빌드(로컬 · 프리뷰 · 포크)는 초기화하지 않고 SDK 코드도 담지 않는다. 호스트에 기본값을 두지 않아 posthog-js 기본 호스트로 조용히 프록시를 우회하는 일이 없다. 페이지뷰만 집계한다 — 자동 수집 · 세션 녹화 · 설문은 끈다. SDK(slim)는 동적 import 로 떼어, 레이아웃 스크립트는 1.7KB gzip 그대로고 PostHog 조각 50KB gzip 은 따로 받는다. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://feat-site-posthog.mdwire.minjun.dev, https://feat-site-posthog-mdwire-site.minjun.workers.dev (commit 3105389)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
사이트 방문을 PostHog 로 집계한다.
*.minjun.dev사이트는 PostHog 프로젝트 하나로 모으고$host로 가르기로 한 결정에 따른 것이다. 페이지뷰만 — 자동 수집 · 세션 녹화 · 설문은 끈다.변경 사항
키와 프록시 주소는 빌드 변수로만 들어온다
POSTHOG_KEY·POSTHOG_HOST를astro:env스키마로 받는다. 하나라도 없으면 초기화하지 않고 SDK 코드도 담지 않는다 — 변수를 안 준 로컬 · 프리뷰 · 포크 빌드는 아무것도 보내지 않는다. 호스트에 기본값을 두지 않아 posthog-js 기본 호스트로 조용히 프록시를 우회하는 일이 없다.site/src/analytics.ts:10
스키마 — 둘 다 선택, 호스트는 URL 검증
값은 Workers Builds 의 프로덕션 빌드 변수에만 넣는다(이미 넣음). 프리뷰는 보내지 않는다.
site/astro.config.mjs:76
SDK 는 slim 번들을 동적 import 로 뗀다
레이아웃 스크립트는 1.7KB gzip 그대로고, PostHog 조각 50KB gzip 은 따로 받는다. 변수 없는 빌드에도 그 조각 파일은
dist/에 남지만(번들러가 코드 제거 전에 떼어 둔다) 아무 데서도 참조하지 않아 받는 일은 없다.검증
변수 없음 · 키만 · 호스트가 URL 아님 · 둘 다, 네 경우로
pnpm run check와pnpm run build를 돌렸다 — 각각 통과(레이아웃 청크가 main 과 동일) · 통과(초기화 안 함) ·EnvInvalidVariables로 중단 · 통과(둘 다 번들에 들어감). 실제로$host = mdwire.minjun.dev이벤트가 들어오는지는 머지 뒤 프로덕션 빌드에서 확인한다.🤖 Generated with Claude Code