Skip to content

Restructure Group Analytics into Hierarchical and Standard Groups - #249

Draft
mherrman wants to merge 9 commits into
mainfrom
mherrman-port-hierarchical-groups
Draft

mherrman wants to merge 9 commits into
mainfrom
mherrman-port-hierarchical-groups

Conversation

@mherrman

Copy link
Copy Markdown
Contributor

Why

Ports the Hierarchical Groups content from mixpanel/docs-legacy#2647 into the new docs site. Group Analytics now has two distinct data models — Hierarchical and Standard — and the current docs only describe the Standard one, so B2B customers have no documentation for the $company_id/$user_id model.

What

  • Rewrite group-analytics.mdx as an overview that forks between the two models, with a comparison table for choosing between them
  • Add hierarchical-groups.mdx covering composite identity, prerequisites, data model, identity management, implementation (Import API + Warehouse Connectors + Groups HTTP API), and FAQ
  • Add standard-group-analytics.mdx, absorbing the retired Implementation and FAQ pages
  • Delete group-analytics-implementation.mdx and group-analytics-faq.mdx, with docs.json redirects to Standard Groups so existing URLs don't 404
  • Convert all ported content from Nextra to Mintlify syntax

Test plan

  • Mintlify preview build renders all three pages, including the <Tabs> SDK block and the comparison table
  • Nav shows "Hierarchical Groups" and "Standard Groups" under Group Analytics; both retired URLs redirect to Standard Groups
  • Verified locally: docs.json parses as valid JSON, all 10 referenced images exist, and no page in the repo links to the two deleted files

Notes for reviewers

One open content question, inherited from the source PR and left in deliberately for a reviewer to resolve:

  • standard-group-analytics.mdx states "up to 5 group keys per project" under Overview, but "up to 3 group keys, Enterprise can increase to 6 for an additional fee" under Limits. These contradict each other — please confirm which is correct.

Deviations from the legacy PR:

  • The legacy PR dropped the B2B Company Analytics section entirely. It is kept here, since it documents live functionality and is the only home for the Company Profiles and Activation Metrics images.
  • Fixed a broken anchor (#identity_managment#identity-management) and an FAQ list that skipped from 1 to 3.
  • Retargeted the two pre-existing #setup-b2b-company-key links to the Standard Groups page, where that section now lives.
  • The YouTube overview embed and group_analytics_data_model.png are dropped, mirroring the legacy PR. group_analytics_data_model.png is now unreferenced.
  • hierarchical-groups is .mdx rather than the source's .md, to match repo convention.

Conversions applied: H1 → YAML frontmatter; <Callout type="info"><Note>; the irreversible-setup blockquote → <Warning>; <Tabs items={[…]}><Tabs.Tab><Tabs><Tab title="…">; images → /images/… in <Frame>; relative links → absolute; _meta.ts → the navigation block in docs.json.

🤖 Generated with Claude Code

Ports the content from mixpanel/docs-legacy#2647 into the Mintlify docs
site, converting Nextra syntax to Mintlify components.

- Rewrite group-analytics.mdx as an overview that forks between the two
  models, with a comparison table
- Add hierarchical-groups.mdx covering the $company_id/$user_id composite
  identity model, implementation, and FAQ
- Add standard-group-analytics.mdx, absorbing the implementation and FAQ
  pages
- Redirect the retired implementation and FAQ URLs to Standard Groups

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mintlify

mintlify Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
mixpanel-docs 🟢 Ready View Preview Sep 16, 2026, 5:59 PM

@greptile-apps

greptile-apps Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 3/5

The PR is not yet safe to merge because the Hierarchical Groups Import API example can produce a rejected request, and a previous identity-documentation issue remains unresolved.

Findings

  1. P1 Required Identity Field Missing
  2. P1 Group ID Replaces User Identity
  3. P2 Required Fields Missing From Schemas
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Group Analytics] --> B{Required data model}
  B -->|Company → User hierarchy| C[Hierarchical Groups]
  B -->|Independent grouping dimensions| D[Standard Groups]
  C --> E[Composite company and user identity]
  D --> F[Unchanged user identity plus group keys]
Loading

Reviews (7) · Last reviewed commit: "Apply suggestion from @mherrman"

Comment on lines +29 to +33
</Note>

Group level:

```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Group ID Replaces User Identity

Standard Groups do not replace an event’s user distinct_id with the group ID, as this page later confirms. Labeling <group_id> as distinct_id can lead implementers to send group IDs as user identities, combining unrelated users and corrupting user-level analysis. Describe this as the group’s analysis identifier instead.

Knowledge Base Used: Identity, profiles, and groups

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment thread docs/data-structure/group-analytics/standard-group-analytics.mdx Outdated
Comment on lines +174 to +178
To create or update company profiles via the HTTP API, use the `/groups` endpoint. There are three key values that must be set in order to properly set profiles for Hierarchical Groups (outside of `$set`) — `$group_key`, `$group_id`, and `$company_id`.

- `$group_key` — the name of the group key you want to set the profile properties to (`$company_id`, `$user_id`, etc.)
- `$group_id` — the actual value of the group key you want to set those properties on (`acme`, `user_123`, etc.)
- `$company_id` — the value of the parent `$company_id` associated with this child entity (`acme`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Required Fields Missing From Schemas

The new instructions require $company_id for hierarchical /groups requests and a Company ID mapping for warehouse Group Tables, but the corresponding public schemas expose neither field. This leaves generated references and clients unable to represent the required company scope. Update those API contracts alongside this page, or clarify the supported configuration path. The same mismatch appears in the Group Table instructions at lines 249–253.

Knowledge Base Used: Identity, profiles, and groups

Copilot AI and others added 2 commits September 15, 2026 23:01
Co-authored-by: mherrman <24963335+mherrman@users.noreply.github.com>
Co-authored-by: mherrman <24963335+mherrman@users.noreply.github.com>
Comment thread docs/data-structure/group-analytics/standard-group-analytics.mdx Outdated
- Reword the frontmatter `description` so the reserved-property names no
  longer render as KaTeX math (the `$company_id`/`$user_id` `$…$` pair was
  garbling the page subtitle).
- Demote the "Groups HTTP API" heading from H3 to H4 so it nests under
  "Updating Group Profiles" alongside "Warehouse Connector: Profiles".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JwB62afN5wxzrfpMvKPuJV
Comment thread docs/data-structure/group-analytics/hierarchical-groups.mdx Outdated

Identity Management works only on the user level. In Hierarchical Groups, the canonical user identity is determined by the composite of the `$company_id` and `$user_id` values as soon as one of those values is set (so ideally they are set together at the same time). Events sent without `$company_id` and `$user_id` that have a `$device_id` value can later be merged to a canonical user identifier by having `$company_id` and `$user_id` set alongside the `$device_id` value on an event.

Merging the `$device_id` to the canonical `$company_id` and `$user_id` composite means that all events going forward and historically attributed to the `$device_id` would be merged to the composite identifier, similar to how Simplified ID Merge works outside of Hierarchical Groups. At present the merged events are only visible in the User level activity feed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At present the merged events are only visible in the User level activity feed.
This is something that I want to confirm with eng to see if this is intention and will be the case upon GA


Hierarchical Groups can only be implemented via Data Warehouse Connectors or directly via the HTTP APIs. The groups methods in Mixpanel's SDKs only support standard groups.

### Group Keys in Project Settings

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to confirm its been changed such that the defaults ($company_id and $user_id) still need to be set as group props manually. iirc we intended to have those be set automatically as special

Comment thread docs/data-structure/group-analytics/hierarchical-groups.mdx Outdated
Comment thread docs/data-structure/group-analytics/hierarchical-groups.mdx Outdated
Comment on lines +126 to +143
curl --request POST \
--url 'https://api.mixpanel.com/import?strict=1&project_id=YOUR_PROJECT_ID' \
--header 'Content-Type: application/json' \
--header 'accept: application/json' \
--header 'authorization: Basic AUTH_HERE' \
--data '[
{
"event": "Feature Used",
"properties": {
"time": 1690000000,
"$insert_id": "unique_event_id",
"$company_id": "acme",
"$user_id": "alice",
"feature_name": "dashboard"
}
}
]'
```

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to verify how we want to present distinct_id here. i don't think it has any impact on what the resultant id is for the user in MP if $user_id and $company_id are present but i also dont think you can technically send an event to /import API in strict mode without that property present?

Comment on lines +135 to +139
"time": 1690000000,
"$insert_id": "unique_event_id",
"$company_id": "acme",
"$user_id": "alice",
"feature_name": "dashboard"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Required Identity Field Missing

This strict Import API example omits distinct_id, even though the preceding instructions and the Import API schema require it. Readers who copy this request will receive a validation error instead of ingesting the event. Include a placeholder distinct_id that Hierarchical Groups can override.

Suggested change
"time": 1690000000,
"$insert_id": "unique_event_id",
"$company_id": "acme",
"$user_id": "alice",
"feature_name": "dashboard"
"time": 1690000000,
"$insert_id": "unique_event_id",
"distinct_id": "placeholder",
"$company_id": "acme",
"$user_id": "alice",
"feature_name": "dashboard"

Knowledge Base Used: Identity, profiles, and groups

@greptile-apps

greptile-apps Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

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