Group Analytics
Overview
In a B2B product the unit that matters is rarely the individual. Group analytics lets you attach every event to an organisation, workspace, team or account, so retention, funnels and revenue can be measured per company rather than per seat.
Group analytics is a metered add-on, billed per identified event with a monthly free allowance. It bills forward-only from the moment you enable it — events captured before the cutoff are never retroactively charged.
Associating a user with a group
Call group() once you know which organisation the current user belongs to. The association is remembered for the session, so every subsequent event carries it automatically — you do not tag events individually.
// iOS
BillDog.shared.group(
groupType: "company",
groupKey: "acme-inc",
properties: ["plan": "enterprise", "seats": 250]
)// Android — note the parameter is groupProperties, not properties
BillDog.group(
groupType = "company",
groupKey = "acme-inc",
groupProperties = mapOf("plan" to "enterprise", "seats" to 250)
)React Native exposes the same capability under a different shape — association and properties are two calls rather than one, and they live on the analytics module:
// React Native
import { AnalyticsManager } from '@billdog.io/react-native';
await AnalyticsManager.getInstance().setGroup('company', 'acme-inc');
await AnalyticsManager.getInstance().setGroupProperties('company', 'acme-inc', {
plan: 'enterprise',
seats: 250,
});groupType is the kind of group (company, workspace, team). groupKey is the specific instance. Calling it emits a $groupidentify event carrying any properties you pass, which is how group attributes stay current.
Five slots, and one BillDog keeps
A project may define up to five group types, mapped internally to group_0 … group_4. That cap matches PostHog's.
group_5 is reserved. BillDog populates it automatically with the customer's active entitlement — e.g. premium or pro, falling back to free for identified users and null for anonymous ones. Any $group_5 an SDK sends is ignored. This gives you a subscription cohort on every event without wiring anything.
One caveat, and it lands on exactly the B2B case this page is about. group_5 reads the entitlements granted to that customer directly. An entitlement a member inherits from a BillDog Auth organization is never written onto their own customer record — it exists only in the ent claim of their session token, which is the union of personal and organization entitlements computed when the token is issued. A paying member of a subscribed organization can therefore read free in group_5. When the plan behind a seat is what you are measuring, carry it yourself — pass it as a group property on one of your own slots, as plan is passed in the examples above — rather than reading group_5. See Organizations.
Analysing by group
Once events carry group associations, group becomes a breakdown dimension across analytics — count distinct companies rather than users, build funnels where the converting unit is an account, and measure retention at the organisation level.
Billing & the enablement cutoff
Metering is per identified event, with the first tranche each month free and a sliding scale beyond it. Anonymous events are not charged as group events.
Billing starts at your enablement timestamp and never runs backwards. Two consequences worth knowing:
- Group columns are written on every event row at ingest, independently of whether the add-on is on. Historical events that already carried
$group_xproperties are therefore analysable with no backfill — only the query window and billing need unlocking. - Events captured before you ever sent group properties have empty group columns and would need a user-to-group mapping backfill to become groupable.
Analysing history from before your cutoff is a separate paid operation — it is never applied automatically, so enabling the add-on cannot produce a surprise retroactive bill. See Pricing.
Related
Was this page helpful?
Or rate this page: