Group analytics

New: Customer analytics preview

Group analytics is getting a makeover! Sign up for the customer analytics feature preview to get a sneak peek, and share your feedback.

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

  1. Define group types - like "company" or "channel"
  2. Assign group keys (unique identifiers) to each group
  3. Link events to groups in your code
  4. Analyze data by group instead of by user

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:

ProductFunctionalityExample
Product analyticsAggregate trends, funnels, retention, and stickiness by groupTrack how many companies completed onboarding
Feature flagsConfigure release conditions based on groupsEnsure all users of a company see the same feature flag variant
ExperimentsEvaluate experiment results based on group aggregationsRun an A/B test to improve activation rate for new companies
Data warehouseJoin tables or enrich queries with groups dataWrite 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'
}
});
Tips for group keys
  • Use singular names for group types - "company" not "companies"
  • Use unique IDs as keys for individual groups, not names because names can duplicate
  • Each project can have up to 5 group types
  • You can have unlimited individual groups within each type

Set group properties

Every individual group can have properties associated with it, just like persons. For example, for a "company" group type, you might add company_name, date_joined, and subscription as properties for each individual group company.

Individual groups require at least one property

You must include at least one group property for an individual group to appear in the people tab in the PostHog app.

// Option 1 (recommended): Set properties in posthog.group()
// This has the side-effect that all subsequent events in the session are associated to the group
posthog.group('company', 'company_id_in_your_db', {
name: 'PostHog',
subscription: "subscription",
date_joined: '2020-01-23'
});
// Option 2:
// Set properties in posthog.capture()
// This method doesn't have the side-effect of associating all future events to the group.
posthog.capture('$groupidentify', {
'$group_type': 'company',
'$group_key': 'company_id_in_your_db',
'$group_set': {
name: 'PostHog',
subscription: "subscription",
date_joined: '2020-01-23'
}
});

Properties on individual groups work the same way as properties on people. They can be used in experiments and feature flags to roll out features to specific groups.

The PostHog app identifies an individual group using the name property. If the name property isn't found, it falls back to the group key.

How you link events to individual groups depends on your SDK:

  • JavaScript Web SDK: Call posthog.group() once and all session events link to that individual group automatically.
  • Other SDKs: Pass the group information in the groups parameter for every event you capture.

Events must be identified to link to individual groups. If $process_person_profile is set to false, the event won't link to the group.

Multiple groups per event

You can't assign one event to multiple individual groups of the same group type, but you can assign it to individual groups of different group types.

// Not possible
posthog.group('company', 'company_id_in_your_db');
posthog.group('company', 'another_company_id_in_your_db');
posthog.capture('user_signed_up')
// Allowed
posthog.group('company', 'company_id_in_your_db');
posthog.group('channel', 'channel_id_in_your_db');
posthog.capture('user_signed_up')

Capture events for individual groups without a user

If you want to capture events for an individual group without linking them to a specific user, use a single static string as the distinct ID:

posthog.capture({
event: 'group_event_name',
distinctId: 'static_string_for_group_events',
groups: { 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.

View groups

Analyze insights by group type

Use insights to view trends aggregated by group type.

For example, to see how many organizations signed up recently:

  1. Create an insight with your signup event.
  2. Expand the menu next to the event.
  3. Select Unique with your group type.

This shows total individual groups that signed up instead of individual users.

Analyze group insights

Use group types with funnels

Track how individual groups organizations move through conversion steps by setting Aggregating by to your group type.

This shows how many individual groups completed each step, the drop-off percentage, and which specific individual groups dropped off.

Group funnels

Use group types with feature flags

Create a feature flag and select your group type in the Match by dropdown under Release conditions.

Update your code to pass group information when checking feature flags:

// Make sure you have called posthog.group() earlier in that session
if (posthog.isFeatureEnabled('new-groups-feature')) {
// Do something
}

Rename group types

Change how group types display in PostHog in Settings > Customer analytics.

Groups in project settings

Delete group types

To delete a group type:

  1. Go to the people tab in the PostHog app.
  2. Select Menu options > Delete group type.
Delete group type
What happens when you delete a group type
  • Event data remains unchanged. Group data is filtered from queries based on a deletion timestamp.
  • Deleted group types don't count toward your 5 group type limit.
  • If new events arrive with the same group key, the group type reappears with a new creation timestamp. Historical events (before the new timestamp) won't appear for the recreated group type.

Limitations

Group analytics has a few limitations to be aware of:

  • Maximum of 5 group types per project
  • You can delete group types, but not individual groups
  • Multiple individual groups of the same group type can't be assigned to a single event
  • Group types aren't supported for lifecycle insights or user paths
  • Only individual groups with known properties appear in the people tab

Further reading

Community questions

Was this page useful?

Questions about this page? or post a community question.