VoidhashDocs
DevelopersHelp centerGuidesAPI reference
voidhash.comOpen Studio
Get started
Introduction
Quickstart
How Voidhash works
Glossary
Versions and releases
Concepts
Teams, projects and environments
API keys
Products and perks
Offers
Subscription lifecycle
People and identity
Groups
Events
Features
Paywalls in your app
Feature flags and A/B tests
Paywall components
Push notifications
Ad attribution in your app
Client SDKs
React Native
Swift
Kotlin
Web
Your backend
Node.js
PHP
Go
Rust
Other languages
Payment sources
Forward store notifications
Developer tools
CLI
MCP server
Query analytics with VoidQL
Web SDK
Web quickstart
Script tag
Identify users
Evaluate feature flags
Track
Track events
Groups
Page views and attribution
Privacy
Privacy and consent
Browser storage
Connect a consent tool
Keep data out of analytics
Revenue and attribution
Sell on the web
Stripe revenue
Web-to-app handoff
Delivery
First-party proxy
Tracking domain
Reference
Web SDK reference
Errors
Troubleshooting
Theme

Groups

Tie a user's events to their company, workspace or team, and describe those groups.

Groups are what your users belong to, such as the company or workspace they use your app as part of. Once the SDK knows a user's group, every event carries it, so Studio can count active companies, split charts by plan and list who in a company uses your app.

Put the user in a group

Call group() with the group type, the group's key and, optionally, its properties, for example after sign-in or when the user switches workspace:

await voidhash.group("company", "acme", { name: "Acme", plan: "pro", seats: 40 });
await voidhash.group("team", "acme-design");
  • A group type is a key such as company: a lower-case letter, then up to 63 lower-case letters, digits or underscores. A project keeps up to 5 types.
  • A group key is your own ID for the group, 1 to 256 characters. A number is kept as text.
  • The user belongs to one group of each type: calling group() again with another key moves them.
  • Properties are strings, numbers or booleans. name is what Studio shows as the group's name.

group() rejects an invalid type or key with VoidhashInvalidArgumentError.

Set every group at once

When your app knows all of a user's groups, pass them to setGroups() in one call. It replaces the whole set, so you don't track which group the user joined or left:

await voidhash.setGroups({
  company: { id: "acme", name: "Acme", plan: "pro", seats: 40 }, // the ID, with the properties
  team: "acme-design", // an ID alone
});
  • Each entry is a group's ID, or an object with the id and the group's properties beside it. A group can't have a property called id.
  • A type you leave out, or set to null or undefined, is dropped. {} does what resetGroups() does.
  • An invalid type or ID rejects with VoidhashInvalidArgumentError and changes nothing.

Call it whenever the groups might have changed, such as on every page load or after your user data refreshes. Calling it again with the same groups sends nothing.

What the SDK sends

Every later event carries the user's groups in its $groups property, such as { company: "acme", team: "acme-design" }. A group an event names itself wins for its type:

await voidhash.track("report_shared", { $groups: { team: "acme-sales" } });

group() also sends a $groupidentify event, which sets the group's properties, when you pass properties or when the user's group of that type changed. setGroups() sends one only for a group whose ID changed or whose properties differ from the ones it last sent; leaving a group sends nothing. A later change of a property wins.

A group and its properties are what your app says about the user, not what the user did, so they are sent whatever the analytics consent. While consent is not granted, the $groupidentify goes out at once on its own, with only the group's type, ID and properties: no page, session or device details. It is not retried if it fails; the next setGroups() call sends it again. The $groups property still travels only on events, which need consent. Properties you know on your server are better set from there, with groupIdentify.

Read and clear groups

voidhash.getGroups(); // { company: "acme", team: "acme-design" }
await voidhash.resetGroups(); // later events carry no groups

Groups are stored in the browser with the user's distinct ID, so they last across page loads and other tabs of your site follow a change. signOut() and reset() clear them with the identity whenever they act; the $sign_out event still carries the groups of the user who signed out.

Next steps

  • Groups
  • Track events
  • Reference

Something wrong or missing on this page? Tell us by email or on Discord.

PreviousTrack eventsNextPage views and attribution
© 2026 Voidhash s.r.o.
voidhash.comPricingTermsPrivacyDiscord

On this page

Put the user in a groupSet every group at onceWhat the SDK sendsRead and clear groupsNext steps