PostHog / posthog.com

Official docs, website, and handbook for PostHog.
https://posthog.com
Other
407 stars 414 forks source link

Feedback on: Group analytics #5174

Open drjayvee opened 1 year ago

drjayvee commented 1 year ago

Issue with: /manual/group-analytics.mdx

The PHP example for Creating groups uses a property $groups. I doubt that's correct.

The other languages use groups. When I do capture an event using $groups, the API request will contain


{
  "$groups": {"org" => "name"},
  "groups": []
}`
drjayvee commented 1 year ago

As an aside, might I suggest you use the short form for arrays: [] instead of array().

neilkakkar commented 1 year ago

It's indeed correct - the raw API accepts $groups, not groups, other languages use groups as a keyword argument, which we internally turn into $groups.

How is the empty groups array coming in to your request? 🤔

drjayvee commented 1 year ago

How is the empty groups array coming in to your request? 🤔

https://github.com/PostHog/posthog-php/blob/master/lib/Client.php#L530