Skip to content

Commit b9cc171

Browse files
brody-0125claude
andauthored
Add GoatCounter analytics integration (#48)
* feat: GoatCounter 조회수 트래킹 추가 무료, 쿠키 없는 프라이버시 친화적 분석 도구인 GoatCounter를 추가합니다. NEXT_PUBLIC_GOATCOUNTER_CODE 환경 변수로 활성화할 수 있습니다. https://claude.ai/code/session_018zmvR3KqyN12izgt3BUw6i * ci: deploy 워크플로우에 GoatCounter 환경 변수 추가 빌드 시 NEXT_PUBLIC_GOATCOUNTER_CODE secrets를 주입하여 GoatCounter 트래킹 스크립트가 정적 빌드에 포함되도록 합니다. https://claude.ai/code/session_018zmvR3KqyN12izgt3BUw6i --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 858cf26 commit b9cc171

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
- name: Build
4545
run: npm run build
4646
working-directory: web
47+
env:
48+
NEXT_PUBLIC_GOATCOUNTER_CODE: ${{ secrets.NEXT_PUBLIC_GOATCOUNTER_CODE }}
4749

4850
- name: Copy CNAME
4951
run: cp CNAME web/out/CNAME

web/.env.local.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
NEXT_PUBLIC_GAS_URL=https://script.google.com/macros/s/YOUR_DEPLOYMENT_ID/exec
22
NEXT_PUBLIC_RECAPTCHA_SITE_KEY=YOUR_RECAPTCHA_V3_SITE_KEY
3+
NEXT_PUBLIC_GOATCOUNTER_CODE=YOUR_GOATCOUNTER_SITE_CODE

web/src/app/layout.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { THEME_INIT_SCRIPT } from '@/lib/theme';
66
import './globals.css';
77

88
const recaptchaSiteKey = process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY;
9+
const goatcounterCode = process.env.NEXT_PUBLIC_GOATCOUNTER_CODE;
910

1011
export const metadata: Metadata = {
1112
title: '나들이 — 오늘은 어디로 가볼까?',
@@ -40,6 +41,13 @@ export default function RootLayout({
4041
{children}
4142
</ThemeProvider>
4243
<ContactCTA />
44+
{goatcounterCode && (
45+
<Script
46+
data-goatcounter={`https://${goatcounterCode}.goatcounter.com/count`}
47+
src="//gc.zgo.at/count.js"
48+
strategy="afterInteractive"
49+
/>
50+
)}
4351
</body>
4452
</html>
4553
);

0 commit comments

Comments
 (0)