group()
The group() method associates a user with a company, organisation, or account. This is useful for B2B applications where you need to attribute events to a specific organisation.
Syntax
iOS (Swift)
Datafly.shared.group(groupId: String, traits: [String: Any]? = nil)Android (Kotlin)
Datafly.group(groupId: String, traits: Map<String, Any>? = null)React Native / Cordova
DataflySignal.group(groupId, traits?)Flutter
await DataflySignal.group(groupId, traits: {...})Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
groupId | String | Yes | Unique identifier for the company/organisation |
traits | Dictionary/Map | No | Key-value pairs describing the group |
Usage
Datafly.shared.group(groupId: "company-456", traits: [
"name": "Acme Corp",
"industry": "Technology",
"plan": "enterprise",
"employees": 250,
])Once called, the groupId is included in all subsequent events until reset() is called.
Common traits
| Trait | Type | Description |
|---|---|---|
name | String | Company name |
industry | String | Industry vertical |
plan | String | Subscription plan |
employees | Int | Number of employees |
website | String | Company website URL |
createdAt | String | ISO 8601 date the account was created |