cookie-consent.ts
Cookie 同意模式、分类和第三方服务。
config/cookie-consent.ts 配置 Cookie 同意方式、提示文案、Cookie 分类和第三方服务。统计服务的 Key 必须与 analytics.ts 一致,广告服务的 Key 必须与 ads.ts 一致。
通用字段
必要 Cookie、功能 Cookie、统计服务和广告服务都使用以下字段:
mode
bannerOverlay
policyVersion
configVersion
title
description
模板默认的 value 为:
We use cookies to make this website work, improve your experience, and understand how our site is used. Necessary cookies are always enabled because they are required for security, login, checkout, and basic site functions. You can accept all cookies, reject non-essential cookies, or customize your preferences.
Learn more in our [Cookie Policy](/cookies).categories
necessary
必要 Cookie 直接使用上面的通用字段。
functionality
items
theme
analytics
items
模板默认列出以下统计服务,均为 enabled: true、readOnly: false。使用 prompt 模式时,用户可以逐项开启或关闭。某项服务在 analytics.ts 中缺少必要参数时,不会显示在 Cookie 偏好设置中。
| Key | title.value | description.value |
|---|---|---|
googleAnalytics | Google Analytics | Helps us measure website traffic, page views, user interactions, and conversions so we can improve the website. |
clarity | Microsoft Clarity | Helps us understand how visitors interact with the website through usage insights such as clicks, scrolling, and page behavior. |
cloudflareBeacon | Cloudflare Web Analytics | Provides privacy-friendly website analytics, including page views, traffic sources, performance metrics, and basic visitor insights. |
umami | Umami | Helps us collect privacy-friendly website analytics, such as page views, referrers, devices, and general usage trends. |
plausible | Plausible Analytics | Helps us measure website traffic and usage trends with lightweight, privacy-friendly analytics. |
posthog | PostHog | Helps us understand product usage, feature interactions, funnels, and user journeys so we can improve the product experience. |
seline | Seline | Helps us measure website traffic, visitor behavior, referrers, and usage trends with privacy-focused analytics. |
ahrefs | Ahrefs Web Analytics | Helps us understand website traffic, search performance, referrers, and content effectiveness. |
dataFast | DataFast | Helps us track website traffic, conversions, referrers, and key growth metrics so we can improve our marketing and product decisions. |
openPanel | OpenPanel | Helps us understand website and product usage, including page views, events, funnels, and user interactions. |
marketing
items
googleAdsense
模板默认使用 silent 模式
silent 模式不显示 Cookie 选择界面,而是直接加载 analytics.ts 和 ads.ts 中已经配置的脚本,同时忽略各项配置中的 enabled 和 readOnly。网站正式上线前,应结合适用地区、所用服务和隐私政策,确认是否需要改为 prompt。