feat: add data retention settings to SiteSettingsPage, including subscription-based options and UI updates for user interaction

This commit is contained in:
Usman Baig
2026-02-21 18:21:43 +01:00
parent 42ed7d91dd
commit 1ae20dba4c
4 changed files with 108 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
import type { Site } from '@/lib/api/sites'
import { formatRetentionMonths } from '@/lib/plans'
const DOCS_URL =
(typeof process !== 'undefined' && process.env?.NEXT_PUBLIC_APP_URL)
@@ -22,6 +23,7 @@ export function generatePrivacySnippet(site: Site): string {
const screen = site.collect_screen_resolution ?? true
const perf = site.enable_performance_insights ?? false
const filterBots = site.filter_bots ?? true
const retentionMonths = site.data_retention_months ?? 12
const parts: string[] = []
if (paths) parts.push('which pages are viewed')
@@ -44,6 +46,9 @@ export function generatePrivacySnippet(site: Site): string {
if (filterBots) {
p2 += 'Known bots and referrer spam are excluded from our analytics. '
}
if (retentionMonths > 0) {
p2 += `Raw event data is automatically deleted after ${formatRetentionMonths(retentionMonths)}. `
}
p2 += `Data is processed in a privacy-preserving way and is not used to identify individuals. For more information, see Pulse's documentation: ${DOCS_URL}`
return `${p1}\n\n${p2}`