Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group Analytics #9

Closed
wants to merge 16 commits into from
Closed

Group Analytics #9

wants to merge 16 commits into from

Conversation

taj-p
Copy link

@taj-p taj-p commented Dec 23, 2023

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

@oliverb123
Copy link
Contributor

Thanks for the PR! Closing as I think Event::add_group covers the latter part of this, and the code has changed sufficiently that I think starting from scratch with group identifies would make sense. I would be very open to a new PR to add the group identification!.

@oliverb123 oliverb123 closed this Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants