PostHog / posthog-rs

MIT License
16 stars 11 forks source link

Group Analytics #9

Open taj-p opened 9 months ago

taj-p commented 9 months ago

Groups

Group analytics support.

Identifying Groups

Groups can be created with group_identify.

let client = crate::client(env!("POSTHOG_API_KEY"));

let mut event = GroupIdentify::new("organisation", "some_id");
event.insert_prop("status", "active").unwrap();

client.group_identify(event).unwrap();

Associating Events with a Group

let client = crate::client(env!("POSTHOG_API_KEY"));

let mut event = Event::new("test", "1234");

// Optionally associate this event with a group (in this case,
// a "company" group type with key "company_id_123").
event.insert_group("company", "company_id_123");

client.capture(event).unwrap();

Depends On