Developer API - Grouping Users

The group call is a way of associating an anonymous or identified user with a group or organization. Common examples might be tying a user to a company or a project.

You can call group multiple times with different details to associate the user with multiple groups or to add additional information to the group if the id is the same.

Typical Group Request

Using the JavaScript client a typical group request will look like this:

darwinClient.group("groupId12345", {
  name: "Darwin Inc.",
  industry: "Technology",
  employees: 100,
  plan: "enterprise",
})

The above call with associate the current session (user) with a group that has a unique groupId and the details provided in the call.

Group Data Structure

Groups tracking works in a similar way to user tracking. Each group identification request takes a groupId along with traits to associate with the group.

Field Type Description
groupIdstringUnique id for the group in your database. (required)
traitsobjectAn object describing the group's traits. Includes reserved and free-form properties. (optional)

Group ID

A groupId is the identifier you use to associate with the group. You'll need to generate this or otherwise acquire it from your DB.

Group Traits

Field Type Description
emailstringEmail for group
namestringGroup's name
descriptionstringText description for the group
phonestringGroup phone number
idstringThe unique id for the group. Typically from DB.
websitestringThe group's primary website.
addressobjectThe group's street address
Fields:
citycountrypostalCodestatestreet
employeesnumberNumber of employees in the group
avatarstringThe full URL of the group's avatar
planstringPlan the group has or belongs to.
industrystringIndustry a user works in, or a group is part of
createdAtdateDate when the group was created. ISO-8601 format.