feat: persist script feature toggles to backend

Features (scroll, 404, outbound, downloads, frustration, storage, ttl)
are saved to site.script_features JSONB column on every toggle change.
Values are read from the site object on load.
This commit is contained in:
Usman Baig
2026-03-22 15:31:45 +01:00
parent e626350f14
commit b7e92abb40
3 changed files with 38 additions and 11 deletions

View File

@@ -809,9 +809,15 @@ export default function SiteSettingsPage() {
Add this script to your website to start tracking visitors. Choose your framework for setup instructions.
</p>
<ScriptSetupBlock
site={{ domain: site.domain, name: site.name }}
site={{ domain: site.domain, name: site.name, script_features: site.script_features }}
showFrameworkPicker
className="mb-4"
onFeaturesChange={async (features) => {
try {
await updateSite(siteId, { name: site.name, script_features: features })
mutateSite()
} catch { /* silent — not critical */ }
}}
/>
<div className="flex items-center gap-4 mt-4">