How Databuddy stores, retains, and deletes your analytics data with configurable retention policies.
Databuddy provides flexible data retention policies that balance analytical value with privacy and cost efficiency. All data stored is anonymous by design, containing no personal information.
You can customize retention periods for your website:
1
Navigate to Settings
Go to Website Settings → Data Management → Retention Policy
2
Choose Retention Period
Select from preset options:
30 days (minimal retention)
90 days (default)
180 days (6 months)
365 days (1 year)
730 days (2 years)
Custom period
3
Configure by Data Type
Set different retention for:
Raw events
Aggregated statistics
Performance metrics
Custom events
4
Apply Changes
Changes take effect within 24 hours. Existing data is not affected retroactively.
Best Practice: Retain raw events for 90 days for detailed analysis, and aggregated data for longer periods for trend analysis. This balances analytical value with storage costs and privacy.
Databuddy automatically deletes data older than your retention period:
Daily Cleanup Process
Aggregation Before Deletion
Automated Deletion Query (conceptual)
-- Runs daily at 00:00 UTCDELETE FROM events WHERE timestamp < NOW() - INTERVAL '90 days' AND website_id = 'site_123';DELETE FROM sessionsWHERE start_time < NOW() - INTERVAL '90 days' AND website_id = 'site_123';DELETE FROM web_vitalsWHERE timestamp < NOW() - INTERVAL '90 days' AND website_id = 'site_123';
Before deleting raw events, data is aggregated:
Aggregation Process (conceptual)
-- Create daily aggregates before deleting raw eventsINSERT INTO daily_statisticsSELECT DATE(timestamp) as date, website_id, page, COUNT(*) as total_views, COUNT(DISTINCT anonymous_id) as unique_visitors, AVG(duration_seconds) as avg_durationFROM eventsWHERE DATE(timestamp) = CURRENT_DATE - INTERVAL '90 days'GROUP BY DATE(timestamp), website_id, page;-- Then delete raw eventsDELETE FROM eventsWHERE DATE(timestamp) = CURRENT_DATE - INTERVAL '90 days';
function optOutOfAnalytics() { // Set opt-out flags localStorage.setItem("databuddy_opt_out", "true"); localStorage.setItem("databuddy_disabled", "true"); // Clear existing data localStorage.removeItem("did"); sessionStorage.removeItem("did_session"); // Set global flag window.databuddyOptedOut = true; console.log("Analytics disabled. Reload page for changes to take effect.");}
Implemented in source: packages/tracker/src/index.ts:404-405The tracker respects opt-out on every request:
Deleted data is permanently removed from all databases and backups within 30 days. It cannot be recovered.
Can I recover deleted data?
No. Once data passes its retention period or is manually deleted, it’s gone forever. Always export data before deletion if you might need it later.
Does changing retention affect existing data?
Increasing retention: Existing data is preserved longer.Decreasing retention: Data older than new retention period is deleted within 24 hours.
What's included in data exports?
Exports include:
Raw events with all properties
Session metadata
Aggregated statistics
Custom event properties
Formats: CSV, JSON, or Parquet
How long do export files remain available?
Export download URLs are valid for 7 days. After that, you’ll need to request a new export.
Can users request deletion of their anonymous ID?
Users can clear their anonymous ID themselves via localStorage. However, since it’s a random UUID not linked to personal data, GDPR deletion rights don’t technically apply.