diff --git a/app/sites/[id]/settings/page.tsx b/app/sites/[id]/settings/page.tsx index 26b4ff8..8af5a90 100644 --- a/app/sites/[id]/settings/page.tsx +++ b/app/sites/[id]/settings/page.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react' import { useParams, useRouter } from 'next/navigation' -import { getSite, updateSite, resetSiteData, deleteSite, type Site } from '@/lib/api/sites' +import { getSite, updateSite, resetSiteData, deleteSite, type Site, type GeoDataLevel } from '@/lib/api/sites' import { getRealtime } from '@/lib/api/stats' import { toast } from 'sonner' import LoadingOverlay from '@/components/LoadingOverlay' @@ -52,7 +52,13 @@ export default function SiteSettingsPage() { timezone: 'UTC', is_public: false, password: '', - excluded_paths: '' + excluded_paths: '', + // Data collection settings + collect_page_paths: true, + collect_referrers: true, + collect_device_info: true, + collect_geo_data: 'full' as GeoDataLevel, + collect_screen_resolution: true }) const [scriptCopied, setScriptCopied] = useState(false) const [linkCopied, setLinkCopied] = useState(false) @@ -73,7 +79,13 @@ export default function SiteSettingsPage() { timezone: data.timezone || 'UTC', is_public: data.is_public || false, password: '', // Don't show existing password - excluded_paths: (data.excluded_paths || []).join('\n') + excluded_paths: (data.excluded_paths || []).join('\n'), + // Data collection settings (default to true/full for backwards compatibility) + collect_page_paths: data.collect_page_paths ?? true, + collect_referrers: data.collect_referrers ?? true, + collect_device_info: data.collect_device_info ?? true, + collect_geo_data: data.collect_geo_data || 'full', + collect_screen_resolution: data.collect_screen_resolution ?? true }) if (data.has_password) { setIsPasswordEnabled(true) @@ -103,7 +115,13 @@ export default function SiteSettingsPage() { is_public: formData.is_public, password: isPasswordEnabled ? (formData.password || undefined) : undefined, clear_password: !isPasswordEnabled, - excluded_paths: excludedPathsArray + excluded_paths: excludedPathsArray, + // Data collection settings + collect_page_paths: formData.collect_page_paths, + collect_referrers: formData.collect_referrers, + collect_device_info: formData.collect_device_info, + collect_geo_data: formData.collect_geo_data, + collect_screen_resolution: formData.collect_screen_resolution }) toast.success('Site updated successfully') loadSite() @@ -521,10 +539,129 @@ export default function SiteSettingsPage() {