Repository navigation
feat(analytics): instrument OHE first-install onboarding in PostHog (OHE-3657) - #1103
Merged
hieptl merged 2 commits intoNov 2, 2026
Conversation
…OHE-3657) Self-hosted Enterprise installs currently send nothing to PostHog, so the product team cannot see whether a Docker Compose evaluator registers, finishes the install wizard, or creates an automation. This adds the server-side events for that funnel and a deliberate switch to turn them on for self-hosted installs. - `user signed up` now carries `is_super_admin` and `is_instance_setup_user`, computed in `accept_tos` from the user's super role and `instance_settings.setup_user_id`, so the first Super Admin's registration can be told apart from later signups. - New `ohe_instance_setup_completed` event, fired when `PATCH /api/admin/setup-state` flips `wizard_completed` to true. It records `company_name`, `org_name` and `has_company_logo`, sets the same company/org names on the person profile, and updates the `org` group with `setup_completed_at`. - New `license_key_configured` common property on every event, read from `LICENSE_KEY_CONFIGURED`. It defaults to false because the app has no license concept yet. - `SaasAppLifespanService` keeps analytics off for `self_hosted` unless `ENABLE_POSTHOG_ANALYTICS` is set, instead of unconditionally discarding the key. Cloud behavior is unchanged. - Docker Compose turns the switch on and shares `POSTHOG_CLIENT_KEY` with the automation server (`AUTOMATION_POSTHOG_API_KEY`), labelled `self_hosted`, so automation events join the same funnel. The key itself is still supplied by the operator. - EVENTS.md documents the new event, properties and the switch. Tests cover the new properties and event, the opt-in switch, the license flag, the TOS flags for the first Super Admin versus a regular user, and the setup-state transition (including not re-reporting a finished wizard).
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
hieptl
marked this pull request as ready for review
November 2, 2026 07:58
…-3657) The product owner asked for every OHE onboarding event to use an `ohe_`-prefixed snake_case name. `ohe_instance_setup_completed` already did, but self-hosted sign-ups still went out as `user signed up`. - `track_user_signed_up` sends `ohe_user_signed_up` when the app runs as self-hosted Enterprise (SaaS app mode with `deployment_kind: local`). Cloud keeps `user signed up`, so existing SaaS dashboards are unaffected. Properties are unchanged. - EVENTS.md notes the self-hosted name.
hieptl
deleted the
hiep/ohe-3657-posthog-instrument-first-time-user-onboarding-with-posthog
branch
November 2, 2026 13:30
Contributor
|
🚀 Released in 1.83.0. |
2 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HUMAN:
AGENT:
Why
Self-hosted Enterprise (OHE) installs currently send nothing to PostHog, so the product team cannot see whether a Docker Compose evaluator registers, finishes the install wizard, or creates an automation. This adds the server-side events for that funnel and a deliberate switch to turn them on for self-hosted installs. The event table was approved by the product owner in OHE-3854 (https://linear.app/all-hands-ai/issue/OHE-3854/provide-a-table-of-event-names-properties-that-well-track).
Summary
user signed upgainsis_super_adminandis_instance_setup_user, and self-hosted installs send it asohe_user_signed_up(Cloud keeps the current name). A newohe_instance_setup_completedevent fires when the first Super Admin finishes the/installwizard and records the company and organization names on the event, the person profile and theorggroup.license_key_configuredproperty (fromLICENSE_KEY_CONFIGURED, default false), andSaasAppLifespanServicekeeps analytics off for self-hosted installs unlessENABLE_POSTHOG_ANALYTICSis set, instead of discarding the key unconditionally.POSTHOG_CLIENT_KEYwith the automation server (labelledself_hosted); EVENTS.md documents the additions.Issue Number
OHE-3657: https://linear.app/all-hands-ai/issue/OHE-3657/posthog-instrument-first-time-user-onboarding-with-posthog-events
How to Test
uv run pytest tests/unit/test_analytics_service.py tests/unit/test_saas_lifespan.py tests/unit/server/routes/test_auth_onboarding.py tests/unit/server/routes/test_instance_admin.py. The new tests cover the event and properties, the opt-in switch, the license flag, the TOS flags for the first Super Admin versus a regular user, and the setup-state transition (including not re-reporting a finished wizard).POSTHOG_CLIENT_KEY=<project key>in.env, rundocker compose up --wait, open http://localhost:9043, sign up as the first Super Admin, accept the terms, complete/install(company, organization), then create an automation in/canvas. In PostHog the person (user UUID) should showemail,company_nameandorg_name, with eventsohe_user_signed_up(is_instance_setup_user: true),ohe_instance_setup_completed(the names) andohe_automation_created(automation_name,is_first_automation_in_org: true), all withdeployment_kind: local.ENABLE_POSTHOG_ANALYTICS=false(or an empty key) and confirm the app, worker and automation server make no/capturerequests.I ran step 1 (104 + 123 tests passing) plus ruff, mypy on the changed files and
docker compose config. Step 2 still needs the project key (see Notes).Video/Screenshots
Server-side events only; nothing changes in the UI.
Type
Notes
ohe_names from the approved table, so the SaaS dashboards that key onuser signed upandautomation_createdare unaffected. Helm installs stay off (the switch defaults to off). The compose stack opts in but ships no key; untilPOSTHOG_CLIENT_KEYis supplied nothing is sent.AUTOMATION_TELEMETRY_DEPLOYMENT_MODE,ohe_automation_createdon self-hosted) and OpenHands/docs docs(enterprise): describe Docker Compose telemetry and how to turn it off (OHE-3657) docs#1057 (compose telemetry note). The compose wiring here expects the automation release that includes the override.is_super_adminas a person property: the existing TOS test pinsset_person_propertiesto{email, signed_up_at}. It can be set through$seton the signup capture instead, or that test can be changed.docker-compose.yml.Enterprise server image for this PR: