feat: update website-creator to static mode with ConsentOS + tracking scripts

- Remove Astro DB (no longer needed for consent logging)
- Change from SSR to static output mode
- Add TrackingScripts.astro with GA4, GTM, Umami, Clarity, FB Pixel, Google Ads, TikTok, LINE
- Use ConsentOS consent-loader.js for auto-blocking tracking scripts
- Update Dockerfile to nginx static hosting
- Remove old consent template (custom consent no longer needed)
- Update SKILL.md, AGENTS.md, README.md documentation
- Add nginx.conf for static hosting
This commit is contained in:
2026-04-21 21:19:32 +07:00
parent d1edc9cd6c
commit c38cc4ae26
19 changed files with 378 additions and 1099 deletions

View File

@@ -522,54 +522,58 @@ const { post } = Astro.props;
2. **Terms of Service** — ใช้ `templates/terms-of-service.md`
3. **Consent System** — ใช้ consent script จาก `consent.moreminimore.com`
3. **ConsentOS + Tracking Scripts** — ใช้ `src/components/TrackingScripts.astro`
**Environment Variables สำหรับ Consent:**
**Template มี TrackingScripts.astro ที่รองรับ:**
| Category | Script | ENV Variable |
|----------|--------|-------------|
| Analytics | Google Analytics 4 | `PUBLIC_GA4_ID` |
| Analytics | Google Tag Manager | `PUBLIC_GTM_ID` |
| Analytics | Umami | `PUBLIC_UMAMI_URL`, `PUBLIC_UMAMI_WEBSITE_ID` |
| Analytics | Microsoft Clarity | `PUBLIC_CLARITY_ID` |
| Marketing | Facebook Pixel | `PUBLIC_FB_PIXEL_ID` |
| Marketing | Google Ads | `PUBLIC_GOOGLE_ADS_ID` |
| Marketing | TikTok Pixel | `PUBLIC_TIKTOK_PIXEL_ID` |
| Marketing | LINE Channel Tag | `PUBLIC_LINE_CHANNEL_ID` |
**Environment Variables:**
```bash
# .env
CONSENT_SITE_ID=your-site-id-here
CONSENT_API_BASE=https://consent.moreminimore.com
# ConsentOS
PUBLIC_CONSENT_SITE_ID=your-consent-site-id
PUBLIC_CONSENT_API_BASE=https://consent.moreminimore.com
# Analytics
PUBLIC_GA4_ID=G-XXXXXXXXXX
PUBLIC_GTM_ID=GTM-XXXXXXX
PUBLIC_UMAMI_URL=https://umami.example.com
PUBLIC_UMAMI_WEBSITE_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
PUBLIC_CLARITY_ID=xxxxxxxxxx
# Marketing
PUBLIC_FB_PIXEL_ID=123456789
PUBLIC_GOOGLE_ADS_ID=AW-123456789
PUBLIC_TIKTOK_PIXEL_ID=XXXXXXXX
PUBLIC_LINE_CHANNEL_ID=1234567890
```
**เพิ่ม Consent Script ใน Layout:**
**Tracking Flow:**
```astro
---
// src/layouts/Layout.astro
const { title, description } = Astro.props;
const consentSiteId = import.meta.env.PUBLIC_CONSENT_SITE_ID || 'demo';
const consentApiBase = import.meta.env.PUBLIC_CONSENT_API_BASE || 'https://consent.moreminimore.com';
---
<!DOCTYPE html>
<html lang="th">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{title}</title>
<meta name="description" content={description} />
</head>
<body>
<slot />
<!-- Consent Script -->
<script
src={`${consentApiBase}/consent-loader.js`}
data-site-id={consentSiteId}
data-api-base={consentApiBase}
></script>
</body>
</html>
```
TrackingScripts.astro (data-consent-category attributes)
ConsentOS consent-loader.js (scan + auto-block)
Scripts execute only after user consent
```
**Consent Options:**
- Accept All / Reject All / Customize
- ถ้า reject → ไม่ load GA4/marketing scripts
- Server-side logging ใน consent service ของตัวเอง
**Consent Categories:**
- **Analytics** — GA4, GTM, Umami, Clarity
- **Marketing** — Facebook Pixel, TikTok, LINE, Google Ads
**3.1 Right to be Forgotten**
- Consent service มี API สำหรับลบข้อมูล user
**Right to be Forgotten:**
- ConsentOS มี API สำหรับลบข้อมูล user
---