PostHog
Connect
Connect PostHog from the terminal. Pass --help for the flags PostHog accepts.
polylane integration connect --type posthogOAuth with one project chosen on PostHog's consent screen.
Connect PostHog and choose one project on PostHog's consent screen. Agents read errors, replays, feature flag changes, and product analytics, and new PostHog errors arrive as Polylane issues.
- Start the PostHog connection in Polylane. PostHog opens its consent screen.
- Sign in to PostHog US Cloud or EU Cloud, choose one project, and approve the access listed under Scopes.
- PostHog sends you back to Polylane, which connects the project.
On connect, Polylane creates one HTTP destination named "Polylane error alerts" in the project. Disconnecting deletes it.
How it works
Error alerts become issues
The destination sends three PostHog error tracking events to Polylane: a new error, a reopened error, and a spiking error. Polylane checks the signature, the timestamp, and the project of each delivery, and drops a delivery that it already received. Each PostHog error maps to one Polylane issue, and Polylane investigates it. A spiking error arrives as critical. New and reopened errors arrive with the severity "error". PostHog sends no notice when an error recovers.
Polylane checks the destination every hour and repairs it if it is disabled or missing. The destination needs the hog_function:write scope. If the grant does not include it, Polylane sends a notice that asks you to reconnect PostHog. If PostHog refuses the destination for billing reasons, the daily checks keep running.
Daily checks
Product analytics settles per day, so Polylane checks the project once a day:
- The event volume of the five most active events.
- Trends pinned to a dashboard.
- Number displays with a relative date range, recalculated from their saved query.
- Saved trends, HogQL queries, and alert queries that Polylane can run, up to ten for each connection.
A clear change opens an issue. A check that cannot read complete data reports no reading, and never marks an issue as recovered. On the integration page, you can turn the checks off.
The checks and the agents share one request budget for the project. A result that Polylane serves from its cache does not use the budget.
Polylane also explores the connection when you connect it and every 12 hours after that, and records what it finds as issues.
During an investigation
Read PostHog data and request API changes through Polylane. Agents query product data, read saved insights, dashboards and notebooks, explain feature flag changes and experiments, read errors with their logs and traces, and find session replays and the affected users. Changes require safety review and approval, and the connected project's OAuth grant limits which operations are available.
Polylane refreshes the OAuth token. If the token stays expired for more than 12 hours, Polylane asks you to reconnect.
Scopes
| Tool | Scopes | What they unlock |
|---|---|---|
posthogQuery | user:read, project:read, query:read, event_definition:read, property_definition:read, action:read | Queries product data and discovers events, properties, and actions. |
posthogInsights | insight:read, dashboard:read, notebook:read, alert:read | Reads saved analysis, dashboards, notebooks, and alerts. |
posthogChanges | feature_flag:read, experiment:read, experiment_holdout:read, experiment_saved_metric:read, early_access_feature:read, activity_log:read | Explains feature changes, experiments, and rollouts. |
posthogAnnotations | annotation:read | Reads chart annotations. |
posthogErrors | error_tracking:read, health_issue:read, logs:read, metrics:read, tracing:read, llm_analytics:read, endpoint:read | Reads errors and the telemetry that explains them. |
posthogReplays | session_recording:read, session_recording_playlist:read, person:read, cohort:read, group:read, survey:read | Finds sessions and the audiences affected. |
| Alert delivery | hog_function:write | Manages one HTTP destination for error tracking issue alerts. |
posthogApi | organization:read, hog_function:read, batch_export:read, warehouse_table:read, warehouse_view:read, external_data_source:read, integration:read, web_analytics:read, heatmap:read, annotation:write, dashboard:write | Calls the PostHog API. A call other than GET needs a reason and must stay within the granted scopes. |
Disconnecting
Disconnecting deletes the destination that Polylane created and leaves the PostHog authorized application in place. Remove it under Settings → Connected applications in PostHog. Polylane does not revoke the application itself. A revoke in PostHog removes every grant that you gave the application.
Disconnect
Disconnecting stops every sync and check and deletes the credentials Polylane held. Polylane removes what PostHog's API lets it remove. The following stays until you remove it yourself:
- PostHog authorized application
polylane integration disconnect <id>Tools
7Operations agents can perform in threads.