Controlling data storage
This guide covers the various features available after data reaches PostHog Cloud servers to help you achieve your privacy goals. If you have data that cannot reach a third-party server like PostHog, please omit them during data collection.
This guide covers the following features:
| Feature | Description |
|---|---|
| Data storage location | Control where your data is physically stored for GDPR compliance |
| Processing data before storage | Redact or filter data before it's stored in PostHog |
| Data retention | How long PostHog keeps each type of data |
| Data deletion | Tools to help comply with data deletion requests |
| Data access control | Manage who can access what data in PostHog |
Data storage location
If you require GDPR compliance, there are specific guidelines on the location of data storage if you collect personal data. If you require robust GDPR compliance, we recommend using PostHog Cloud EU – a managed version of PostHog that's hosted on servers based in Frankfurt.
Processing data before storage
PostHog supports realtime transformations of data before it's stored in PostHog. These transformations are applied to all events captured in realtime, so you can use them to:
- Hashing PII data before it's stored in PostHog
- Disabling default GeoIP enrichment transformations
- Dropping events based on a filter
- IP anonymization
When in doubt, you can always create your own custom transformation. Custom transformations use the Hog language to transform data.
Discarding IP addresses at project level
You can configure your project to discard client IP addresses from stored events. Navigate to Settings > Project > IP data capture configuration and enable the Discard client IP data toggle.
When this setting is enabled:
- Client IP addresses are not stored with your events
- Transformations like GeoIP enrichment and bot detection can still use the IP before it is discarded
This allows you to enrich your events with location data or filter out bot traffic while ensuring raw IP addresses are not retained in your data.
Note: This does not apply when Cookieless server hash mode is enabled. In cookieless mode, the IP is stripped before transformations run, so GeoIP enrichment and bot detection won't enrich your events.
See all default event properties collected
| Name | Key | Example value |
|---|---|---|
| Timestamp | $timestamp | 2024-05-29T17:32:07.202Z |
| OS | $os | Mac OS X |
| OS Version | $os_version | 10.15.7 |
| Browser | $browser | Chrome |
| Browser Version | $browser_version | 125 |
| Device Type | $device_type | Desktop |
| Current URL | $current_url | https://example.com/page |
| Host | $host | example.com |
| Path Name | $pathname | /page |
| Screen Height | $screen_height | 1080 |
| Screen Width | $screen_width | 1920 |
| Viewport Height | $viewport_height | 950 |
| Viewport Width | $viewport_width | 1903 |
| Library | $lib | web |
| Library Version | $lib_version | 1.31.0 |
| Search Engine | $search_engine | google |
| Referrer URL | $referrer | https://google.com |
| Referring Domain | $referring_domain | www.google.com |
| Active Feature Flags | $active_feature_flags | ['beta_feature'] |
| Event Type | $event_type | click |
| UTM Source | $utm_source | newsletter |
| UTM Medium | $utm_medium | email |
| UTM Campaign | $utm_campaign | product_launch |
| UTM Term | $utm_term | new+product |
| UTM Content | $utm_content | logolink |
| Google Click ID | $gclid | TeSter-123 |
| Google Ads Source | $gad_source | google_ads |
| Google Search Ads 360 Click | $gclsrc | dsa |
| Google DoubleClick Click ID | $dclid | testDclid123 |
| Google Web-to-app Measure | $wbraid | testWbraid123 |
| Google App-to-web Measure | $gbraid | testGbraid123 |
| Facebook Click ID | $fbclid | testFbclid123 |
| Microsoft Click ID | $msclkid | testMsclkid123 |
| Twitter Click ID | $twclid | testTwclid123 |
| LinkedIn Ad Tracking ID | $la_fat_id | testLaFatId123 |
| Mailchimp Campaign ID | $mc_cid | testMcCid123 |
| Instagram Share Id | $igshid | testIgshid123 |
| TikTok Click ID | $ttclid | testTtclid123 |
| Plugins Succeeded | $plugins_succeeded | ['GeoIP (56578)'] |
| Plugins Failed | $plugins_failed | ['plugin3'] |
| Plugins Deferred | $plugins_deferred | ['plugin4'] |
| IP Address | $ip | 192.168.1.1 |
Data retention
How long PostHog keeps your data depends on the type of data. This table covers the main types. Follow the links for details and settings.
| Data | How long PostHog keeps it |
|---|---|
| Events | Depends on your plan and retention setting. See events retention. |
| Person profiles and properties | Until you delete them. Events retention doesn't apply to them. |
| Session recordings | Depends on your plan. See recording retention. |
| AI events | The large properties of $ai_ events, like prompts and outputs, are deleted after 30 days. See AI event data retention. |
| Logs | 14 days by default. See logs retention. |
| Heatmaps | 90 days. |
| Data pipeline logs | 90 days for the logs of destinations and transformations. |
| File download exports | One week. See file download exports. |
| Query log | 3 months. See query log retention. |
| PostHog AI chats | Until the user, project, or organization they belong to is deleted. Deleting a chat hides it, but PostHog keeps it until then. |
| Support tickets | While your account is active. Deleted tickets are permanently removed 14 days after deletion. |
| Backups | About two weeks for event data and about 12 months for app data. See backups. |
Backups
PostHog keeps backups so it can restore service after an incident. Backups expire on a fixed schedule:
- Event data: about two weeks
- App data stored in Postgres, such as your account, project settings, and support tickets: about 12 months
Retention periods and deletion requests don't apply to data inside backups. Data you delete stays in existing backups until those backups expire.
Data deletion
You can remove unwanted data from PostHog by deleting groups and persons.
| What to delete | Where to delete | Additional details |
|---|---|---|
| Your account | Account settings | Account is deleted immediately; all stored data about you is cleared within 30 days, apart from copies in backups. See deleting your account. |
| Projects | Project settings | All data under the project (including events) are automatically removed |
| Organizations | Organization settings | Deletion is processed in the background and typically takes a couple of minutes. You'll see a blocking screen while it completes. All data under the organization's projects (including events) are automatically removed. |
| Persons | In the persons tab, by API | When a person is deleted, all events and session recordings for that person can be deleted. Some data isn't covered, see what deleting a person doesn't remove |
Organization admins can also set a custom events retention window. PostHog deletes events older than the window at the next monthly cleanup, not right away. To answer a right to be forgotten request, delete the person instead.
Right to be forgotten
User deletion requests are not immediate, but processed asynchronously. We recommend that you avoid reusing a deleted distinct_id value for a new user, as it may lead to unexpected results while the deletion is being processed. Once the deletion process is fully processed, PostHog does not retain any data associated with the deleted distinct_id.
If you must reuse the distinct_id, you can do so using the Reset deleted person tool, available from the dropdown at the top-right of the persons page. This tool enables you to reset a deleted distinct_id so that future events associated with it create a new person profile.
If you instead want to split a person with multiple IDs (e.g. to isolate bad data tied to a specific distinct_id), use the Split IDs button on their person profile.
Persons and events can be deleted using our API endpoints. This action requires a personal API key.
To query all persons in your project, use the GET Persons API endpoint. You can filter for specific subsets of persons using the query parameters. For example, you can get a specific person by filtering by email:
To delete persons and their events, use the DELETE Persons API endpoint with the person's UUID (returned as id in the persons API response). To delete the person's corresponding events, add the delete_events=true parameter. To also delete their session recordings, add delete_recordings=true:
This request deletes all events of the person(s) captured before the deletion request. When delete_recordings=true is set, all session recordings for the person are permanently destroyed using crypto-shredding, which irreversibly deletes the encryption keys making recordings unreadable. This process cannot be undone.
Bulk delete response
The bulk_delete endpoint returns a 202 once the request is accepted. Person records are not removed during the request. They are queued and deleted in the background, usually within a few minutes, so a successful call reports the matched persons in persons_queued_for_deletion and persons_deleted stays 0. Treat persons_queued_for_deletion as the success signal, not persons_deleted. The endpoint reports failures in deletion_errors rather than with an error status, so check that list: a 202 with entries means those persons were not deleted and you should retry them.
| Field | Type | Description |
|---|---|---|
persons_found | integer | Number of persons matched by the provided IDs or distinct IDs |
persons_queued_for_deletion | integer | Number of persons queued for deletion in the background. Their person records and distinct IDs are removed shortly after the request completes. 0 if keep_person was set to true |
persons_deleted | integer | Number of person records deleted during the request itself. 0 when the deletion was queued or keep_person was set to true |
events_queued_for_deletion | boolean | Whether event deletion was queued for the matched persons |
recordings_queued_for_deletion | boolean | Whether recording deletion was queued for the matched persons |
deletion_errors | array | Persons whose deletion did not complete during the request, each containing person_uuid and the step that failed. Always empty when the deletion was queued |
Deleting a single person with DELETE /api/projects/:project_id/persons/:id still removes the person during the request and returns an empty 202.
Checking deletion status
Event deletions run asynchronously during non-peak hours. To check the status of queued event deletions, use the deletion status endpoint:
Query parameters:
status- Filter bypending,completed, orall(default:all)person_uuid- Filter by a specific person UUID
Response fields:
| Field | Type | Description |
|---|---|---|
person_uuid | string | The UUID of the person whose events are queued for deletion |
created_at | string | When the deletion was requested (ISO 8601) |
status | string | Current status: pending or completed |
delete_verified_at | string | When the deletion was verified complete, or null if still pending |
Manual data deletion
You can manually delete persons and their events in the PostHog UI:
- Select Persons from the left-hand menu
- Search for the person via their
distinct_idor a property like email. - Click view next to the person within the search results
- Click Delete person to remove them and all their associated data from the PostHog instance. You will be prompted to confirm this action.
Deleting events without a person profile
Person deletion removes events by person. Events captured without a person profile, such as anonymous events, have no person to delete, so the person deletion tools can't remove them on their own.
To delete all the events for one distinct ID, give the distinct ID a person profile first, then delete that person:
- Send a
$setevent for the distinct ID with the capture API. This creates a person profile for the distinct ID, and its existing events and recordings are linked to that person. Send it from your server or withcurl, because the JavaScript Web SDK ignores person calls whenperson_profilesis set to'never'. - Check that the person exists by calling
GET /api/projects/:project_id/persons/?distinct_id=<distinct_id>with a personal API key. Ifresultsis empty, the$setevent hasn't been processed yet, so wait a minute and check again. - Call the bulk delete endpoint with the distinct ID in
distinct_ids,delete_events: true, anddelete_recordings: true. This deletes the person you just created, along with its events and recordings. - Check the deletion status. The events are deleted once
delete_verified_athas a value.
Like other event deletions, the events are deleted asynchronously.
Deleting specific events
To delete events that match more specific criteria, such as events from a specific date range or events with specific properties, contact support and include:
- Your project ID
- How to find the events, such as an event name, property filters, a date range, or a SQL query
- How many events you expect the deletion to match
Support can request the deletion for you, or turn on event deletion in the PostHog app for your organization. Like other event deletions, it runs asynchronously.
What deleting a person doesn't remove
Deleting a person, along with their events and recordings, doesn't remove every copy of their data:
- AI events: person deletion removes the person's
$ai_events from the events table, but not the full copy PostHog keeps inai_events, which includes prompts and outputs. That copy is deleted after 30 days. - Heatmaps: heatmap data can't be deleted per person. It expires after 90 days.
- PostHog AI chats: chats that quote the person's data stay until the chat's user, project, or organization is deleted.
- Events without a person profile: see deleting events without a person profile.
- Backups: deleted data stays in backups until they expire.
- Data you've sent elsewhere: data that batch exports or destinations already sent to other tools stays there. Delete it in those tools.
When expired events are deleted
PostHog doesn't delete events as soon as they pass your retention period. A cleanup runs once a month and deletes a whole calendar month of events at a time, once every event in that month has expired. This means events from early in a month stay longer than events from late in the month, and an event can stay for up to about two months past your retention period.
Deleted events also stay in backups for about two weeks.
Asynchronous data deletion
While most data in PostHog is deleted instantly, event data is not. Instead, event data is cleared asynchronously during non-peak usage times (weekends on PostHog Cloud). The request cutoff time for each batch deletion is two days before the batch runs. Deletion requests that miss the cutoff time will be included in the batch after next.
This is done because data deletion in ClickHouse is expensive and it can impact performance for other users.
Data access control
An important part of protecting your users' privacy is to control who can access what data in PostHog. PostHog provides access control at 3 levels:
It's up to you to use these access control features to grant access to only the people who need to access the data.
You can follow this comprehensive guide to access control to learn more.





