Group analytics - Docs - PostHog
Group analytics
Overview
Group analytics aggregates events by entities like organizations or companies instead of individual users. This is useful when you need to track behavior at the company, team, or project level.
With groups, you can:
- Track how companies progress through onboarding and activation
- Deploy feature flags to entire organizations
- Run experiments at the company level
- Measure metrics like daily active companies or company churn rate
Key concepts
Group types are categories you define - like "company" or "project". You can create up to 5 group types per project.
Groups are the individual entities within each type. For example, if your group type is "company," each group would be a specific company like "Acme Corp" or "Tech Solutions Inc." You can have unlimited groups within each group type.
How it works
- Define group types - like "company" or "channel"
- Assign group keys (unique identifiers) to each group
- Link events to groups in your code
- Analyze data by group instead of by user
Billing
Group analytics is a paid add-on. Here's how billing works:
All identified events count toward billing
Once you subscribe to group analytics, billing applies to all identified events in your project, not just events with group properties attached. This is because group analytics enables infrastructure that processes all identified events to support group-level analysis.
- Billing starts when you enable group analytics from your billing page, not when you add group analytics code to your application.
- Usage is based on captured identified events, even if they don't include group properties.
- Billing stops when you unsubscribe from the billing page. You don't need to remove group analytics code from your application to stop billing.
You can see how enabling group analytics affects your pricing on the pricing calculator.
Use cases
B2B product activation
Create a "company" group type to track how companies progress through your B2B product's onboarding with funnels:
- Calculate number of daily active companies, company churn rate, or feature adoption by company
- See how many companies signed up this month
- Track what percentage completed onboarding
- Measure what percentage of new companies used specific features
Channel retention
Create a "channel" group type for Slack-like apps to measure retention of features by channel:
- Track average messages per channel, monthly active channels, or channel participants
- See which channels consistently use video calling
- Measure how many channels stay active month over month
- Compare feature adoption rates by channel type
Project-level feature flags
Create a "project" group type for collaborative apps like Jira, Notion, or Figma:
- Track project pageviews, users per project, and project engagement
- Target feature flags at the project level
- Roll out refactored code to a few projects first, measure performance and errors, then expand based on results
Cross-product analysis
Group analytics works across PostHog's entire platform. Here's how you can use group types with different products:
| Product | Functionality | Example |
|---|---|---|
| Product analytics | Aggregate trends, funnels, retention, and stickiness by group | Track how many companies completed onboarding |
| Feature flags | Configure release conditions based on groups | Ensure all users of a company see the same feature flag variant |
| Experiments | Evaluate experiment results based on group aggregations | Run an A/B test to improve activation rate for new companies |
| Data warehouse | Join tables or enrich queries with groups data | Write SQL queries that calculate usage across different company sizes |
Groups vs cohorts
Groups and cohorts serve different purposes:
- Groups aggregate events and don't have to be connected to users. They require code in your app to set up.
- Cohorts represent specific sets of users with something in common. They're created in PostHog without additional code.
Use cohorts if you only need to analyze a list of users. They're simpler and faster to implement.
Set up group analytics
Create group types
Create group types before you associate events with them. Call the group identify method to create a group type and set properties.
In this example, we create a "company" group type. For each individual group (company), we set the group key like an ID or domain:
// Call posthog.group() to create a group before capturing events.
// It sends a `$groupidentify` event to create or update the group.
// It will also create the group type if it doesn't exist. In the
// web SDK, it also associates all subsequent events in the session
// with the group.
posthog.group('company', 'company_id_in_your_db');
// This event will be associated with the company above.
posthog.capture('user_signed_up');
// If the group type is already created, you can also manually add
// the `$groups` property to any event you want to associate with
// the group.
posthog.capture('user_signed_up', {
'$groups': {
'company': 'company_id_in_your_db'
}
});
# Call posthog.group_identify() to create a group before capturing events.
# It sends a `$groupidentify` event to create or update the group.
# It will also create the group type if it doesn't exist.
posthog.group_identify('company', 'company_id_in_your_db')
# Once the group is created, you can associate events with it by
# passing the `group` argument. The `group` argument is required
# for every event that should be associated with the group.
posthog.capture(
'user_signed_up',
groups={'company': 'company_id_in_your_db'}
)
// Call posthog.GroupIdentify{} to create a group before capturing events.
// It sends a `$groupidentify` event to create or update the group.
// It will also create the group type if it doesn't exist.
client.Enqueue(posthog.GroupIdentify{
Type: "company",
Key: "company_id_in_your_db",
})
// Once the group is created, you can associate events with it by
// passing the `$groups` property. The `$groups` property is required
// for every event that should be associated with the group.
client.Enqueue(posthog.Capture{
DistinctId: "user_distinct_id",
Event: "user_signed_up",
Groups: posthog.NewGroups().
Set("company", "company_id_in_your_db"),
})
Using groups in PostHog
View individual groups
To view individual groups and their properties, go to the people tab in the PostHog app and select the group type you want to view. Group types are listed under the Groups section.
Analyze insights by group type
Use insights to view trends aggregated by group type.
Use group types with funnels
Track how individual groups organizations move through conversion steps by setting Aggregating by to your group type.
Use group types with feature flags
Create a feature flag and use the Target by selector on a condition set to choose your group type.