You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> **Advanced**: The `group_id` parameter is available for multi-tenant scenarios where a user belongs to multiple organizations and you need to specify which organization context the event occurred in.
Register a group or associate a user with a group.
104
-
105
-
**Without `user_id`**: Register or update group metadata. Use this when you want to set or update properties on a group (e.g., company name, plan, industry).
110
+
Associate a user with a group and/or set group traits.
106
111
107
112
```ruby
113
+
# Associate user with a group and set group traits (most common)
108
114
client.group('org_456', {
109
115
name:'Acme Inc',
110
-
plan:'enterprise',
111
-
industry:'Technology'
112
-
})
113
-
```
114
-
115
-
**With `user_id`**: Associate a user with a group. Use this to link users to their organization. Keep it simple—no traits needed.
116
+
plan:'enterprise'
117
+
}, user_id:'user_123')
116
118
117
-
```ruby
119
+
# Just link a user to a group (traits already set or not needed)
118
120
client.group('org_456', user_id:'user_123')
121
+
122
+
# Just update group traits (e.g., from a webhook or background job)
0 commit comments