People in PostHog represent the users behind your events. You can view them in the People tab.
People have person properties, which enables you do things like:
- Filter on person properties
- Create cohorts
- Use person properties for targeting feature flags, A/B tests, and surveys.
- Track initial UTM values and referrers across anonymous and identified users.
- Query the
persons
table using SQL insights
People and person profiles
Using people in PostHog requires capturing identified events. These create person profiles that attribute events and properties to specific users. Examples of scenarios where you want to capture identified events are:
- Tracking logged-in users in B2B and B2C SaaS apps
- Doing user segmented product analysis
- Growth and marketing teams wanting to analyze the complete conversion lifecycle
On the other hand, there are many use cases that don't require person profiles and can use anonymous events, such as:
- Tracking a marketing website
- Content-focused sites
- B2C apps where users don't sign up or log in
- High volume API server events
Under our current pricing, anonymous events can be up to 4x cheaper than identified events (due to the cost of processing them), so it's recommended to only capture identified events when needed.
Capturing anonymous events
PostHog captures identified events with person profiles by default.
To change this and capture anonymous events in the JavaScript Web SDK, change the person_profiles
config option:
person_profiles: 'always'
(default) - We capture identified events and person profiles for all events.person_profiles: 'identified_only'
(recommended) - We only capture identified events for users for users where person profiles are already created. This is triggered by calling functions likeidentify()
,group()
, and more. Anonymous events are captured from new users and don't create person profiles.
An example of an updated configuration looks like this:
posthog.init('<ph_project_api_key>',{api_host: 'https://us.i.posthog.com',person_profiles: 'identified_only'})
Other SDKs and the API can pass the $process_person_profile
property in events. Again, identified events are enabled by default, but you can disable this by setting the property to false
.
Below is an example in Node, but the same applies to other SDKs:
client.capture({distinctId: 'distinct_id_of_the_user',event: 'movie_played',properties: {$process_person_profile: false,},})
Person profiles and distinct IDs
Below is good information to know when working with distinct IDs and person profiles:
Every event has a
distinct_id
representing a user attached to it. However, not everydistinct_id
has an associated person profile.If a distinct ID already has a person profile created, any events captured with this distinct ID are considered identified events.
Any
distinct_id
created before May 2024 will have a person profile created for them. This means all of their events will be counted as identified events.
Viewing person profiles
Clicking on a person in the People tab opens their profile and shows all their properties.
Events shows all the events a person has triggered, which you can search and filter to find specific events.
Recordings shows all of the session replays a person has generated. Note this is subject to the retention policy of your plan, so people who haven't been active recently may have none.
Cohorts shows all the cohorts a person belongs to.
Related groups: shows groups (e.g. organizations, projects, and instances) a person belongs to.
Feature flags: shows all feature flags that are enabled for the person.
History: shows any manual changes that have been made to the person's profile.
Deleting person data
In the PostHog app
- Search for the person via their unique ID. For example, their email.
- Click on the person's ID
- Click Delete person to remove them and all their associated data. You will be prompted to confirm this action.
Via the API
You can also delete persons data via the API. See the Data Deletion docs for more information.