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

ParameterTypeRequiredDescription
groupIdStringYesUnique identifier for the company/organisation
traitsDictionary/MapNoKey-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

TraitTypeDescription
nameStringCompany name
industryStringIndustry vertical
planStringSubscription plan
employeesIntNumber of employees
websiteStringCompany website URL
createdAtStringISO 8601 date the account was created