Controlling data storage

Last updated:

|Edit this page|

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:

FeatureDescription
Data storage locationControl where your data is physically stored for GDPR compliance
Processing data before storageRedact or filter data before it's stored in PostHog
Data deletionTools to help comply with data deletion requests
Data access controlManage 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:

When in doubt, you can always create your own custom transformation. Custom transformations use the Hog language to transform data.

See all default event properties collected
NameKeyExample value
Timestamp$timestamp2024-05-29T17:32:07.202Z
OS$osMac OS X
OS Version$os_version10.15.7
Browser$browserChrome
Browser Version$browser_version125
Device Type$device_typeDesktop
Current URL$current_urlhttps://example.com/page
Host$hostexample.com
Path Name$pathname/page
Screen Height$screen_height1080
Screen Width$screen_width1920
Viewport Height$viewport_height950
Viewport Width$viewport_width1903
Library$libweb
Library Version$lib_version1.31.0
Search Engine$search_enginegoogle
Referrer URL$referrerhttps://google.com
Referring Domain$referring_domainwww.google.com
Active Feature Flags$active_feature_flags['beta_feature']
Event Type$event_typeclick
UTM Source$utm_sourcenewsletter
UTM Medium$utm_mediumemail
UTM Campaign$utm_campaignproduct_launch
UTM Term$utm_termnew+product
UTM Content$utm_contentlogolink
Google Click ID$gclidTeSter-123
Google Ads Source$gad_sourcegoogle_ads
Google Search Ads 360 Click$gclsrcdsa
Google DoubleClick Click ID$dclidtestDclid123
Google Web-to-app Measure$wbraidtestWbraid123
Google App-to-web Measure$gbraidtestGbraid123
Facebook Click ID$fbclidtestFbclid123
Microsoft Click ID$msclkidtestMsclkid123
Twitter Click ID$twclidtestTwclid123
LinkedIn Ad Tracking ID$la_fat_idtestLaFatId123
Mailchimp Campaign ID$mc_cidtestMcCid123
Instagram Share Id$igshidtestIgshid123
TikTok Click ID$ttclidtestTtclid123
Plugins Succeeded$plugins_succeeded['GeoIP (56578)']
Plugins Failed$plugins_failed['plugin3']
Plugins Deferred$plugins_deferred['plugin4']
IP Address$ip192.168.1.1

Data deletion

You can remove unwanted data from PostHog by deleting groups and persons.

What to deleteWhere to deleteAdditional details
ProjectsProject settingsAll data under the project (including events) are automatically removed
OrganizationsOrganization settingsAll data under the organization's projects (including events) are automatically removed
PersonsIn the persons tab, by APIWhen a person is deleted, all events for that person can be deleted

Right to be forgotten

Note

You can reuse distinct_id values after deletion using the Reset deleted person tool, available from the dropdown at the top-right of the persons page. This tool allows you to reset a deleted distinct_id so that future events associated with it will 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:

export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
https://us.posthog.com/api/projects/:project_id/persons?email={EMAIL}

To delete the persons and their events, you can use the DELETE Persons API endpoint

To do that, iterate through the persons returned in the previous step and use the person's id in the DELETE call. To delete the person's corresponding events in addition to the person, add the delete_events=true parameter. For example:

curl -X DELETE "https://posthog.example.com/api/projects/{YOUR_PROJECT_ID}/persons/{ID}?delete_events=true" \
-H "Authorization: Bearer {YOUR_API_KEY}"

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_id or 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.

Asynchronous data deletion

While most data in PostHog is deleted instantly, event data is not. Instead data is cleared asynchronously during non-peak usage times (weekends on PostHog Cloud).

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:

  1. Organization level
  2. Project level
  3. Resource level

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.

Questions? Ask Max AI.

It's easier than reading through 659 pages of documentation

Community questions

Was this page useful?

Next article

PostHog & GDPR compliance

The General Data Protection Regulation (GDPR) is a privacy and security law, drafted and passed by the European Union (EU). It imposes obligations onto organizations anywhere, so long as they target or collect data related to people in the EU. We recommend that you read the full text of the GDPR and seek independent legal advice regarding your obligations. The consequences of violating GDPR are severe. If you require robust GDPR compliance, we recommend using PostHog Cloud EU – a managed…

Read next article