Groups
How Klime tracks your customers.
Note: Groups are only used in Group mode. If your customers are individuals (User mode), skip this page — you only need
identify()andtrack(). See Settings to check or change your analytics mode.
A group represents a customer in your product — typically a company, organization, team, or shared account.
klime.group(
"acme_inc",
{
name: "Acme Inc",
plan: "enterprise",
industry: "Technology",
},
{ userId: "user_123" },
)Why groups matter
Groups give you a company-level view of your customers. Each group has its own activity timeline, user list, and engagement metrics. User activity is aggregated at the group level so you can see overall customer health.
Important: Your dashboard will be empty until you call
group(). Events fromidentify()andtrack()are recorded in the background, but customers won't appear on your dashboard until users are linked to groups.
Group ID
Use a stable identifier for each group, like your database primary key:
// Good - stable IDs
"acme_inc"
"org_abc123"
// Avoid - can change
"Acme Inc"
"acme.com"Group traits
Traits describe the company. Include business-relevant data like plan level, industry, size, or contract details:
klime.group(
"acme_inc",
{
name: "Acme Inc",
plan: "enterprise",
employeeCount: 250,
industry: "Technology",
},
{ userId: "user_123" },
)Linking users to groups
The group() call does two things: it links a user to a group and optionally sets group traits.
// Link user and set traits
klime.group("acme_inc", { name: "Acme Inc" }, { userId: "user_123" })
// Just link user (traits already set)
klime.group("acme_inc", null, { userId: "user_123" })
// Just update traits (e.g., from a webhook)
klime.group("acme_inc", { plan: "enterprise" })Once a user is linked to a group, all their events are attributed to that group's activity.
Multiple groups
A user can belong to multiple groups. This is useful for agency tools, consulting platforms, or any app where users work across multiple customers.
klime.group("acme_inc", null, { userId: "user_123" })
klime.group("beta_corp", null, { userId: "user_123" })When tracking events for a multi-group user, include the groupId to specify which customer context the event occurred in:
klime.track(
"Report Generated",
{
reportType: "revenue",
},
{
userId: "user_123",
groupId: "acme_inc",
},
)