• Product
  • Pricing
  • Docs
  • Using PostHog
  • Community
  • Company
  • Login
  • Docs

  • Overview
    • Quickstart with PostHog Cloud
    • Overview
      • AWS
      • Azure
      • DigitalOcean
      • Google Cloud Platform
      • Hobby
      • EU Hosting Companies
      • Other platforms
      • Instance settings
      • Environment variables
      • Securing PostHog
      • Monitoring with Grafana
      • Running behind a proxy
      • Configuring email
      • Helm chart configuration
      • Deploying ClickHouse using Altinity.Cloud
      • Configuring Slack
      • Overview
        • Overview
        • Upgrade notes
        • Overview
        • 0001-events-sample-by
        • 0002_events_sample_by
        • 0003_fill_person_distinct_id2
        • ClickHouse
          • Backup
          • Debug hanging / freezing process
          • Horizontal scaling (Sharding & replication)
          • Kafka Engine
          • Resize disk
          • Restore
          • Vertical scaling
        • Kafka
          • Resize disk
          • Log retention
        • PostgreSQL
          • Resize disk
          • Troubleshooting long-running migrations
        • Plugin server
        • MinIO
        • Redis
        • Zookeeper
      • Disaster recovery
    • Troubleshooting and FAQs
    • Support for self-hosting (open-source and enterprise)
    • Managing hosting costs
    • Overview
    • Ingest live data
    • Ingest historical data
    • Identify users
    • User properties
    • Deploying a reverse proxy
    • Library comparison
    • Badge
    • Browser Extensions
      • Snippet installation
      • Android
      • iOS
      • JavaScript
      • Flutter
      • React Native
      • Node.js
      • Go
      • Python
      • Rust
      • Java
      • PHP
      • Ruby
      • Elixir
      • Docusaurus v2
      • Gatsby
      • Google Tag Manager
      • Next.js
      • Nuxt.js
      • Retool
      • RudderStack
      • Segment
      • Sentry
      • Slack
      • Shopify
      • WordPress
      • Message formatting
      • Microsoft Teams
      • Slack
      • Discord
    • To another self-hosted instance
    • To PostHog from Amplitude
    • To PostHog Cloud EU
    • Between Cloud and self-hosted
    • Overview
    • Tutorial
    • Troubleshooting
    • Developer reference
    • Using the PostHog API
    • Jobs
    • Testing
    • TypeScript types
    • Overview
    • POST-only public endpoints
    • Actions
    • Annotations
    • Cohorts
    • Dashboards
    • Event definitions
    • Events
    • Experiments
    • Feature flags
    • Funnels
    • Groups
    • Groups types
    • Insights
    • Invites
    • Members
    • Persons
    • Plugin configs
    • Plugins
    • Projects
    • Property definitions
    • Session recordings
    • Trends
    • Users
    • Data model
    • Overview
    • Data model
    • Ingestion pipeline
    • ClickHouse
    • Querying data
    • Overview
    • GDPR guidance
    • HIPAA guidance
    • CCPA guidance
    • Data egress & compliance
    • Data deletion
    • Overview
    • Code of conduct
    • Recognizing contributions
  • Using PostHog

  • Table of contents
      • Dashboards
      • Funnels
      • Group Analytics
      • Insights
      • Lifecycle
      • Path analysis
      • Retention
      • Stickiness
      • Trends
      • Heatmaps
      • Session Recording
      • Correlation Analysis
      • Experimentation
      • Feature Flags
      • Actions
      • Annotations
      • Cohorts
      • Data Management
      • Events
      • Persons
      • Sessions
      • UTM segmentation
      • Team collaboration
      • Organizations & projects
      • Settings
      • SSO & SAML
      • Toolbar
      • Notifications & alerts
    • Overview
      • Amazon Kinesis Import
      • BitBucket Release Tracker
      • Event Replicator
      • GitHub Release Tracker
      • GitHub Star Sync
      • GitLab Release Tracker
      • Heartbeat
      • Ingestion Alert
      • Email Scoring
      • n8n Connector
      • Orbit Connector
      • Redshift Import
      • Segment Connector
      • Shopify Connector
      • Twitter Followers Tracker
      • Zendesk Connector
      • Airbyte Exporter
      • Amazon S3 Export
      • BigQuery Export
      • Customer.io Connector
      • Databricks Export
      • Engage Connector
      • GCP Pub/Sub Connector
      • Google Cloud Storage Export
      • Hubspot Connector
      • Intercom Connector
      • Migrator 3000
      • PagerDuty Connector
      • PostgreSQL Export
      • Redshift Export
      • RudderStack Export
      • Salesforce Connector
      • Sendgrid Connector
      • Sentry Connector
      • Snowflake Export
      • Twilio Connector
      • Variance Connector
      • Zapier Connector
      • Downsampler
      • Event Sequence Timer
      • First Time Event Tracker
      • Property Filter
      • Property Flattener
      • Schema Enforcer
      • Taxonomy Standardizer
      • Unduplicator
      • Automatic Cohort Creator
      • Currency Normalizer
      • GeoIP Enricher
      • Timestamp Parser
      • URL Normalizer
      • User Agent Populator
  • Tutorials
    • All tutorials
    • Actions
    • Apps
    • Cohorts
    • Dashboards
    • Feature flags
    • Funnels
    • Heatmaps
    • Path analysis
    • Retention
    • Session recording
    • Trends
  • Support
  • Glossary
  • Docs

  • Overview
    • Quickstart with PostHog Cloud
    • Overview
      • AWS
      • Azure
      • DigitalOcean
      • Google Cloud Platform
      • Hobby
      • EU Hosting Companies
      • Other platforms
      • Instance settings
      • Environment variables
      • Securing PostHog
      • Monitoring with Grafana
      • Running behind a proxy
      • Configuring email
      • Helm chart configuration
      • Deploying ClickHouse using Altinity.Cloud
      • Configuring Slack
      • Overview
        • Overview
        • Upgrade notes
        • Overview
        • 0001-events-sample-by
        • 0002_events_sample_by
        • 0003_fill_person_distinct_id2
        • ClickHouse
          • Backup
          • Debug hanging / freezing process
          • Horizontal scaling (Sharding & replication)
          • Kafka Engine
          • Resize disk
          • Restore
          • Vertical scaling
        • Kafka
          • Resize disk
          • Log retention
        • PostgreSQL
          • Resize disk
          • Troubleshooting long-running migrations
        • Plugin server
        • MinIO
        • Redis
        • Zookeeper
      • Disaster recovery
    • Troubleshooting and FAQs
    • Support for self-hosting (open-source and enterprise)
    • Managing hosting costs
    • Overview
    • Ingest live data
    • Ingest historical data
    • Identify users
    • User properties
    • Deploying a reverse proxy
    • Library comparison
    • Badge
    • Browser Extensions
      • Snippet installation
      • Android
      • iOS
      • JavaScript
      • Flutter
      • React Native
      • Node.js
      • Go
      • Python
      • Rust
      • Java
      • PHP
      • Ruby
      • Elixir
      • Docusaurus v2
      • Gatsby
      • Google Tag Manager
      • Next.js
      • Nuxt.js
      • Retool
      • RudderStack
      • Segment
      • Sentry
      • Slack
      • Shopify
      • WordPress
      • Message formatting
      • Microsoft Teams
      • Slack
      • Discord
    • To another self-hosted instance
    • To PostHog from Amplitude
    • To PostHog Cloud EU
    • Between Cloud and self-hosted
    • Overview
    • Tutorial
    • Troubleshooting
    • Developer reference
    • Using the PostHog API
    • Jobs
    • Testing
    • TypeScript types
    • Overview
    • POST-only public endpoints
    • Actions
    • Annotations
    • Cohorts
    • Dashboards
    • Event definitions
    • Events
    • Experiments
    • Feature flags
    • Funnels
    • Groups
    • Groups types
    • Insights
    • Invites
    • Members
    • Persons
    • Plugin configs
    • Plugins
    • Projects
    • Property definitions
    • Session recordings
    • Trends
    • Users
    • Data model
    • Overview
    • Data model
    • Ingestion pipeline
    • ClickHouse
    • Querying data
    • Overview
    • GDPR guidance
    • HIPAA guidance
    • CCPA guidance
    • Data egress & compliance
    • Data deletion
    • Overview
    • Code of conduct
    • Recognizing contributions
  • Using PostHog

  • Table of contents
      • Dashboards
      • Funnels
      • Group Analytics
      • Insights
      • Lifecycle
      • Path analysis
      • Retention
      • Stickiness
      • Trends
      • Heatmaps
      • Session Recording
      • Correlation Analysis
      • Experimentation
      • Feature Flags
      • Actions
      • Annotations
      • Cohorts
      • Data Management
      • Events
      • Persons
      • Sessions
      • UTM segmentation
      • Team collaboration
      • Organizations & projects
      • Settings
      • SSO & SAML
      • Toolbar
      • Notifications & alerts
    • Overview
      • Amazon Kinesis Import
      • BitBucket Release Tracker
      • Event Replicator
      • GitHub Release Tracker
      • GitHub Star Sync
      • GitLab Release Tracker
      • Heartbeat
      • Ingestion Alert
      • Email Scoring
      • n8n Connector
      • Orbit Connector
      • Redshift Import
      • Segment Connector
      • Shopify Connector
      • Twitter Followers Tracker
      • Zendesk Connector
      • Airbyte Exporter
      • Amazon S3 Export
      • BigQuery Export
      • Customer.io Connector
      • Databricks Export
      • Engage Connector
      • GCP Pub/Sub Connector
      • Google Cloud Storage Export
      • Hubspot Connector
      • Intercom Connector
      • Migrator 3000
      • PagerDuty Connector
      • PostgreSQL Export
      • Redshift Export
      • RudderStack Export
      • Salesforce Connector
      • Sendgrid Connector
      • Sentry Connector
      • Snowflake Export
      • Twilio Connector
      • Variance Connector
      • Zapier Connector
      • Downsampler
      • Event Sequence Timer
      • First Time Event Tracker
      • Property Filter
      • Property Flattener
      • Schema Enforcer
      • Taxonomy Standardizer
      • Unduplicator
      • Automatic Cohort Creator
      • Currency Normalizer
      • GeoIP Enricher
      • Timestamp Parser
      • URL Normalizer
      • User Agent Populator
  • Tutorials
    • All tutorials
    • Actions
    • Apps
    • Cohorts
    • Dashboards
    • Feature flags
    • Funnels
    • Heatmaps
    • Path analysis
    • Retention
    • Session recording
    • Trends
  • Support
  • Glossary
  • Using PostHog
  • Product manual
  • Product analytics
  • Group Analytics

Group analytics

Last updated: Nov 14, 2022

On this page

  • Understanding group analytics
  • Groups vs group types
  • Groups vs cohorts
  • Getting started
  • Creating groups
  • Setting and updating group properties
  • Using groups in PostHog
  • Viewing groups and their properties
  • Analyzing group insights
  • Organizations signed up in last week
  • Organization signup funnel
  • Renaming group types
  • Integrating groups with feature flags
  • Limitations
  • Further reading

Groups are a feature which enable you to aggregate events by any entity other than an individual user - such as a company, device, or project. Essentially, groups enable these entities to send events in the same way as a user.

Here are some of the questions that group analytics can help answer:

  • How many companies signed up in the last month?
  • Which posts have had the most activity?
  • How many projects were created in the past month?
  • How does the conversion rate differ between small and large companies?
  • Which communities are growing the fastest?

Groups can be used in other parts of the PostHog suite, including insights, feature flags, and experiments.

Understanding group analytics

Before we learn how to use groups, it's best to get some information about how they behave within PostHog.

At a high-level, a group is simply a way to take a set of events, and 'group' them together under a specific 'type' of entity. This 'entity' can be anything you like (organizations, companies, posts, projects, etc.) and depends entirely on your application.

One very common use case is to create groups that contain events that are sent as part of a larger group of users. This could be things such as making groups for each company that uses your app, to creating a separate group for each community within your app.

Note: While groups are often thought of as representing groups of users, it's important to keep in mind that groups aggregate events and not users directly.

Groups vs group types

When considering group analytics, it is also important to make the distinction between 'Groups' and 'Group types'. A 'group type' is the name for given to the kind of object you are aggregating on (company, project, post), whereas a group is a particular member of that type.

Tip: If you're familiar with object-oriented thinking, you can think of each 'group type' as a class, with each 'group' being a unique instance of that class.

A simple example of a group type might be a company, in which case each group would be a specific company such as PostHog, Google, IBM, etc. There's a hard limit of 5 group types within PostHog, although within each group type you can have unlimited groups.

Another important concept to remember here is that a single event belongs to only a single group per group type. For example, let's say you have a project shared event for when a user shares a project. This event could be associated with both a company and a project, but it can't be associated with two separate companies or two separate projects.

Groups vs cohorts

While groups and cohorts may seem almost identical at first, it's important to understand the differences between them. When comparing, it's important to remember that groups aggregate based on events, not users. While it is possible to view persons that are related to a group, they aren't directly 'members' in the same way as cohorts.

Cohorts represent a singular list of users, whereas groups represent many separate lists of events all under a specific group type.

Following the company example again, you can have a cohort of users which belong to a certain company (e.g. Company A). However, this only represents a single company, and you would need to keep creating new cohorts as users from other organizations signed up, which is not practical. In this case, it's best to create a group type company, and then specify which company each event you send is related to.

Getting started

This section will give an overview of setting up your first group within PostHog.

Creating groups

Groups and group types are defined directly from our libraries when sending events. In the examples below, we use the group type company, and set the unique id for the group to be id:5.

// All subsequent events will be associated with company `id:5`
posthog.group('company', 'id:5');
posthog.capture('some event')

Tip: When specifying the group type, try using the singular version (company instead of companies).

We now have one group with id 5 that has the type company, and the some event that we sent will be attached to this newly created group.

Setting and updating group properties

Every group can have properties associated with it.

Continuing with the previous example of using company as our group type, we might want to add company_name, date_joined, and user_count as additional fields.

Note: You must include at least one group property for a group to be visible in the "Persons & Groups" tab

posthog.group('company', 'id:5', {
name: 'PostHog',
user_count: 33,
date_joined: '2020-01-23T00:00:00.000Z'
});

Properties on groups behave in the exact same way as properties on persons within insights. They can also be used within exepriments and feature flags to rollout features to specific groups.

Note: The PostHog UI identifies a group using the name property. If no name property is found, it falls back to the group key.

Using groups in PostHog

Now that we have created our first group type, we can take a look at how to use groups within PostHog.

Viewing groups and their properties

To view groups and their properties, head to the "Persons and Groups" tab on the navigation bar.

From here you can select the group type you are interested in and view the groups and properties (by clicking the chevrons on the left).

View Groups

You can now click on a specific group to see information such as all the events that have been sent by this group.

Under the 'Related people & groups' tab, you can also see all of the persons who have sent events that we're associated with this group, as well as all the other groups from different types that have shared events.

Analyzing group insights

Using groups in insights works in almost the exact same way as with users, and works by aggregating events and properties based on unique groups. Within a trends insight, you can select which of your group types you would like to view, which will display the count of unique organizations that performed a certain event in a given period.

Organizations signed up in last week

To see a concrete example of groups in action, let's say that we wanted to see a graph showing how many different organizations have signed up recently. Within an insight, we would expand the menu next to the event we've chosen, which should show a list of all the group types you have available.

Selecting 'Unique organizations', this will show us a graph with the total number of organizations that have signed up, as opposed to individual users.

View Groups

Organization signup funnel

Another place where group analytics can be used is within funnels. For example, you may want to understand how an organization moves from their first visit to eventually signing up, which we can do by setting the 'Aggregating by' field to 'Unique organizations'.

This will show how many organizations have made it through, as well as the percentage of organizations that dropped off. It's also possible to see exactly which groups dropped of at a specific step in exactly the same way as with users.

View Groups

Renaming group types

You can change how group types are displayed in your Insights interface and throughout PostHog from the Project settings.

Integrating groups with feature flags

Similar to insights, where you're aggregating events by group type, you can have Feature Flags that work on groups. This allows you to rollout a feature by company, instead of users. Preventing disruption when two users at the same company see a different experience.

You can use feature flags as you normally would, except you need to select the group type you wish to "Match by", using the drop down by release conditions.

You will also need to update your event tracking code (covered below), for the feature flag to be able to determine the groups of the current user.

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

Limitations

  • A maximum of 5 group types can be created per project
  • Multiple groups of the same type cannot assigned to a single event (e.g. Company A & Company B)
  • Groups are not currently supported for the following insights:
    • Lifecycle - Expected soon
    • User Paths - These only support user level analytics
  • Only groups with known properties are shown under 'Persons & groups'
  • Groups cannot be directly deleted

Further reading

Want to know more about what's possible with Groups in PostHog? Try these tutorials:

  • How to track how teams use your product

Want more? Check our full list of PostHog tutorials.

Questions?

Was this page useful?

Next article

Insights

Insights allow you to visualize your Events and Actions in several different ways. Each type of Insight has its own manual in these Docs: Trends Funnels Retention Paths Lifecycle Creating Insights To create a new Insight, click on + next to Insights in the left hand sidebar. You can also click on 'Insights' itself to view and search through your current list of Insights. You can then create Dashboards to collect and present multiple Insights in one place.

Read next article

Authors

  • Ian Vanagas
    Ian Vanagas
  • Paul Hultgren
    Paul Hultgren
  • Paul D'Ambra
    Paul D'Ambra

Feature availability

Free / Open-sourceNot availableThis feature is not available on this plan
Self-serveAvailableThis plan has full access to this feature
EnterpriseAvailableThis plan has full access to this feature

Share

Related articles

  • Tracking how teams use your product

Jump to:

  • Understanding group analytics
  • Groups vs group types
  • Groups vs cohorts
  • Getting started
  • Creating groups
  • Setting and updating group properties
  • Using groups in PostHog
  • Viewing groups and their properties
  • Analyzing group insights
  • Organization signup funnel
  • Renaming group types
  • Integrating groups with feature flags
  • Limitations
  • Further reading
  • Questions?
  • Edit this page
  • Raise an issue
  • Toggle content width
  • Toggle dark mode
  • Product

  • Overview
  • Pricing
  • Product analytics
  • Session recording
  • A/B testing
  • Feature flags
  • Apps
  • Customer stories
  • PostHog vs...
  • Docs

  • Quickstart guide
  • Self-hosting
  • Installing PostHog
  • Building an app
  • API
  • Webhooks
  • How PostHog works
  • Data privacy
  • Using PostHog

  • Product manual
  • Apps manuals
  • Tutorials
  • Community

  • Questions?
  • Product roadmap
  • Contributors
  • Partners
  • Newsletter
  • Merch
  • PostHog FM
  • PostHog on GitHub
  • Handbook

  • Getting started
  • Company
  • Strategy
  • How we work
  • Small teams
  • People & Ops
  • Engineering
  • Product
  • Design
  • Marketing
  • Customer success
  • Company

  • About
  • Team
  • Investors
  • Press
  • Blog
  • FAQ
  • Support
  • Careers
© 2022 PostHog, Inc.
  • Code of conduct
  • Privacy policy
  • Terms