This guide explains how to use the group API in Kotlin SDK.
Overview
The Kotlin SDK provides a group API that lets you link an identified user with a group like a company, organization, or an account. You can also record any custom traits associated with that group like the company name, number of employees, etc.
You can link an identified user to multiple groups.
// Group event with groupId
analytics.group(groupId="<groupId>",)// Group event with groupId and traits
analytics.group(groupId="<groupId>",traits=buildJsonObject{put("key","value")})// Group event with groupId, traits and options
analytics.group(groupId="<groupId>",traits=buildJsonObject{put("key","value")},options=RudderOption(customContext=buildJsonObject{put("key","value")},integrations=buildJsonObject{put("Amplitude",true)put("INTERCOM",buildJsonObject{put("field","value")})},externalIds=listOf(ExternalId(type="<id_type>",id="<value>"),)))
The below table describes the group method signature in detail:
Field
Data type
Description
groupId
String
The group’s unique identifier which lets you identify it in your database.
traits
Traits
Contains traits associated with the group. They are added in the root level of the event.
Note: RudderStack does not store any group traits.
options
RudderOption
Additional event options.
A sample group event sent from the Kotlin SDK is shown below:
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.