新增 GA4 / Meta Pixel 追蹤與 Cookie 同意機制

- 追蹤 ID 存 site_settings(空字串即關閉),於 /admin/settings 管理
- Base.astro 僅在用戶同意後載入分析工具,未同意前零請求
- 新增 /privacy 私隱政策頁與「重設 Cookie 偏好」按鈕
- 前台 SSR 頁面(首頁、blog、about、privacy)傳入 gaId / metaPixelId
- seed 加入預設空值,Footer 加入私隱政策連結
- 同步更新 AGENTS.md 與 README 說明
This commit is contained in:
2026-09-13 20:01:57 +08:00
parent 6dedb5469f
commit fbc562f495
13 changed files with 434 additions and 14 deletions
+3 -1
View File
@@ -19,7 +19,9 @@ INSERT OR REPLACE INTO site_settings (key, value, updated_at) VALUES
('hero_image', 'https://images.unsplash.com/photo-1509391366360-2e959784a276?auto=format&fit=crop&w=1600&q=80', strftime('%s','now')*1000),
('seo_default_title', '盈豐太陽能工程有限公司 — 香港村屋太陽能一站式服務', strftime('%s','now')*1000),
('seo_default_description', '專營香港村屋太陽能系統:現場評估、合法支架、代辦申請、專業安裝及驗收認證。透明報價,專人跟進,幫你善用天台賺取發電回報。', strftime('%s','now')*1000),
('og_image', 'https://images.unsplash.com/photo-1509391366360-2e959784a276?auto=format&fit=crop&w=1200&q=80', strftime('%s','now')*1000);
('og_image', 'https://images.unsplash.com/photo-1509391366360-2e959784a276?auto=format&fit=crop&w=1200&q=80', strftime('%s','now')*1000),
('ga4_measurement_id', '', strftime('%s','now')*1000),
('meta_pixel_id', '', strftime('%s','now')*1000);
INSERT OR REPLACE INTO site_settings (key, value, updated_at) VALUES
('ai_enabled', '1', strftime('%s','now')*1000),