Person profiles and properties

Last updated:

|Edit this page

Person profiles are collections of properties about the users behind the events. You can use these person properties to better capture, analyze, and utilize user data.

For example, you can create filters or cohorts based on person properties, which can then be used to create insights, feature flags, and more.

For backward compatibility, PostHog captures events with person profiles by default. You can change this by setting your JavaScript initialization's person_profiles value to identified_only or an event's $process_person_profile property to false.

Note: Setting person properties creates a profile for the person you are tracking. Under our current pricing, events without person profiles can be up to 4x cheaper than events with them (due to the cost of processing them), so it's recommended only to capture person profiles (via identify() or $set) when needed.

How to set person properties

The recommended way to set properties in person profiles is to send a $set event with a $set property:

posthog.capture(
'$set',
{
$set: { name: 'Max Hedgehog' },
$set_once: { initial_url: '/blog' },
}
)

You can also set person properties when you call the identify method:

posthog.identify(
'distinct_id', // Replace 'distinct_id' with your user's unique identifier
{ email: 'max@hedgehogmail.com', name: 'Max Hedgehog' } // optional: set additional person properties
);

Person property values can be strings, booleans, numbers, objects, or arrays. For objects and arrays, you can use HogQL to access nested properties in PostHog.

Note: Person properties are set in the order the events are ingested, and not according to event timestamps. Since we typically ingest events as soon as we receive them, you only need to take this into consideration when you're importing historical data.

What is the difference between set and set_once?

Using set replaces any property value that may have been set on a person profile. In contrast, set_once only sets the property if it has never been set before.

set is typically used for properties that may change over time – e.g., email, current plan, organization name. set_once is typically only used for information that is guaranteed to never change – e.g., the first URL a user visited, or the date a user first logged in.

For example:

posthog.capture(
'event_name',
{
$set: { name: 'Max Hedgehog' },
$set_once: { initial_url: '/blog' },
}
)
posthog.capture(
'event_name',
{
$set: { name: 'Mr. Fox' },
$set_once: { initial_url: '/pricing' },
}
)
// name: 'Mr. Fox'
// initial_url: '/blog'

Further reading

See our full documentation on persons and person properties for more details.

Questions?

Was this page useful?

Next article

Actions & insights

Actions and insights are the two foundational analysis tools within PostHog. They're easy to get started with, and tricky to fully master, but getting a good idea of all the features they offer will make analysis feel much, much smoother. 1. Creating a new action from autocapture events Before we start, it's worth covering what actions are and what they're useful for. In practice, an action is simply a way to create a new event by filtering and combining one or more events together. Actions can…

Read next article