PostHog
Capture product events, evaluate feature flags, and configure browser analytics with a PostHog project token
Connect PostHog when a project needs product analytics or feature flags. Swarmz accepts the public project token that starts with phc_. It does not accept a personal API key that starts with phx_.
The project token is designed for event ingestion and browser SDK setup. Authorization for reports, dashboards, and PostHog administration is outside this connector.
Availability
A Swarmz administrator must show PostHog under Platform config > Integrations and enable the data and analytics connector flag. PostHog does not require a Swarmz OAuth application.
Connect PostHog
- In PostHog, copy the project token and numeric project ID. PostHog's installation guide identifies the project token used by the SDK.
- In the Swarmz project, open Settings > Integrations and select PostHog.
- Enter the
phc_project token in the API key field. - Enter
usoreuunder PostHog region, then enter the Project ID. - Select Save connection.
Swarmz evaluates flags for a test identity before saving. The region selects a fixed PostHog ingest host; arbitrary API hosts are not accepted.
Available operations
| Operation | What it does | Limit per minute |
|---|---|---|
public_config | Returns the verified browser-safe token, project ID, and ingest host | 10 |
capture | Captures one bounded server-side event | 30 |
evaluate_flags | Evaluates feature flags for one distinct ID | 30 |
Event capture requires allow-once approval. Event property objects are limited to 100 top-level fields and 32 KB. The browser configuration contains the public project token; do not treat it as a private secret in generated code.
Ask the AI to use PostHog
- “Install PostHog in the browser and capture page views and signup completion.”
- “Evaluate the
new-checkoutflag for the signed-in user before rendering the new flow.” - “Capture a server event when an invoice is paid, including the plan but no personal data.”
Use a PostHog MCP server in personal AI chat
If your PostHog setup exposes a compatible Streamable HTTP MCP server, add its HTTPS URL under Personal AI connectors. This does not reuse the project token above. It gives the Swarmz AI only the tools discovered from that server and asks before tools that are not marked read-only. See Custom MCP server.
Verify PostHog
- Ask the AI to return the public configuration and confirm the region and project ID.
- Capture a uniquely named test event.
- Open PostHog's live events view and confirm the distinct ID and properties.
- Evaluate a known feature flag and compare the result with the PostHog interface.
If events reach the wrong project, edit the project token, project ID, and region together. Rotate the project token in PostHog, update the Swarmz connection, then test a new event before retiring the old token. Select Remove to stop the project using the connection.