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
Associate a user with a group and set group traits.
103
+
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).
107
106
108
107
```ruby
109
-
# Simple usage
110
108
client.group('org_456', {
111
109
name:'Acme Inc',
112
-
plan:'enterprise'
110
+
plan:'enterprise',
111
+
industry:'Technology'
113
112
})
113
+
```
114
114
115
-
# With user ID and IP
116
-
client.group('org_456', {
117
-
name:'Acme Inc',
118
-
plan:'enterprise'
119
-
}, user_id:'user_123', ip:'192.168.1.1')
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
+
117
+
```ruby
118
+
client.group('org_456', user_id:'user_123')
120
119
```
121
120
122
121
#### `flush`
@@ -234,12 +233,13 @@ class KlimeMiddleware
234
233
defcall(env)
235
234
status, headers, response =@app.call(env)
236
235
237
-
# Track page views
238
-
if env['REQUEST_METHOD'] =='GET'&& status ==200
236
+
# Track page views for authenticated users
237
+
user_id = env['rack.session']&.dig('user_id')
238
+
if user_id && env['REQUEST_METHOD'] =='GET'&& status ==200
0 commit comments