feat: add Microsoft Clarity analytics provider

Add Microsoft Clarity as a fourth analytics provider option alongside
Umami, Google Analytics, and Custom. Clarity provides free heatmaps,
session recordings, and user analytics.

- admin.types.ts: Add 'clarity' to AnalyticsProvider union type
- api/admin/site/route.ts: Add 'clarity' to validation
- admin/page.tsx: Add Clarity option to dropdown + Project ID input UI
- layout.tsx: Inject Clarity tracking script with project ID
This commit is contained in:
mtvpls-turso
2026-07-11 19:01:16 +00:00
parent d98f5082a5
commit 392211264f
4 changed files with 37 additions and 5 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ export interface AdminConfig {
OIDCMinTrustLevel?: number; // 最低信任等级(仅LinuxDo网站有效,为0时不判断)
// 流量统计配置
AnalyticsEnabled?: boolean; // 是否启用流量统计
AnalyticsProvider?: 'umami' | 'google' | 'custom'; // 统计服务提供商
AnalyticsProvider?: 'umami' | 'google' | 'clarity' | 'custom'; // 统计服务提供商
AnalyticsScriptUrl?: string; // 脚本URLUmami: umami.js地址; GA: gtag URL; 自定义: 脚本src
AnalyticsWebsiteId?: string; // 网站IDUmami: website_id; GA: Measurement ID如G-XXXX; 自定义: 留空)
AnalyticsCustomScript?: string; // 自定义统计代码(仅custom模式使用,完整的HTML脚本内容)