Files
cv/docs/design/specs/v2/spec-v2-analytics.md
dong.nguyen d827bf9b23 feat: resume download, router v7/v8 migrations, spec restructure
- Add resume download button in Hero CTA and Contact section
- Migrate react-router v6→v7 and v7→v8
- Restructure specs: UI specs to specs/ui/, v2 specs to specs/v2/
- Add profile-photo assets (jpg + webp)
- Update AGENTS.md, spec-v2.md index
2026-10-06 14:14:01 +07:00

66 lines
1.1 KiB
Markdown

# Specification — v2 Analytics
> **Document:** `spec-v2-analytics.md`
> **Version:** 0.1.0
> **Parent:** `spec-v2.md`
> **Priority:** P2
> **Estimate:** ~30 minutes
---
## Requirement
Privacy-friendly analytics — không dùng Google Analytics.
---
## Options
**Option A: Plausible Analytics** (recommended)
- Lightweight, privacy-first
- No cookie banner needed
- Simple script integration
**Option B: Umami**
- Self-hosted option
- Open source
- Similar to Plausible
**Option C: Custom minimal tracking**
- Track page views only
- Store in localStorage
- Batch send to endpoint (optional)
---
## Implementation (Plausible)
```tsx
// main.tsx — add script tag
<script
defer
data-domain="yourdomain.com"
src="https://plausible.io/js/script.outbound-links.js"
/>
```
Hoặc dùng `react-use-plausible`:
```tsx
import { usePlausible } from 'react-use-plausible'
const plausible = usePlausible()
// Auto pageview tracking
```
Configurable via env var: `ENABLE_ANALYTICS`
---
## Acceptance
- [ ] Page view tracking hoạt động
- [ ] Không cookie banner
- [ ] Không ảnh hưởng performance
- [ ] Configurable via env var (ENABLE_ANALYTICS)