Edit

Analytics

LearnHouse records what learners do (page views, enrollments, completions, submissions and more) and turns it into dashboards for admins. There are three views:

Availability

DeploymentOverview and Features tabsCourse analyticsLearner analyticsAdvanced tab
LearnHouse CloudStandard plan and abovePro plan and abovePro plan and aboveEnterprise plan
Self-hosted, open sourceNoNoNoNo
Self-hosted, Enterprise EditionYesYesYesYes

Analytics is part of the Enterprise Edition. Open source instances don't collect or store any analytics. Analytics data is only visible to organization admins: users whose role can update the organization (the Admin role by default, or a custom role with that permission).

How it works

Analytics runs inside the LearnHouse API and stores events in the main PostgreSQL database. Nothing is sent to a third-party analytics service.

  1. The web app sends browsing events (page, course and activity views, searches, podcast plays and more) in small batches to POST /api/v1/signals/batch. The path is neutral on purpose, so ad blockers don't drop learners from your numbers. Visitors who aren't signed in are counted for public events only. Time spent, video progress and AI assistant use are only recorded for signed-in members. Only known event names and properties are accepted, and bots are ignored.
  2. The API records server-side events itself when something happens: enrollments, completions, assignment and quiz submissions, grading, sign-ups, logins, certificates, discussions, payments, live sessions, messages and more.
  3. A background job in the API refreshes daily summaries every 5 minutes and deletes events past the organization's retention period once a day.

Each event carries the organization, the user (or an anonymous visitor ID) and a session ID. Time spent on a lesson is capped at 4 hours per event.

Query results are cached in Redis to keep the dashboards fast: 1 minute for overview and course widgets, 5 minutes for advanced widgets, 30 seconds for detail views. The Live Now counter is never cached. If Redis is down, queries go straight to PostgreSQL.

Privacy

  • No cookies. Visitors are not tracked with cookies.
  • No stored IP addresses. A visitor who isn't signed in is counted with a hash that changes every day, so the same person can't be followed across days or across organizations. Signed-in users who aren't members of the organization are counted the same way.
  • Country only. The country comes from a geo header your CDN or proxy adds (cf-ipcountry, x-vercel-ip-country, cloudfront-viewer-country or x-country-code). LearnHouse never looks up IP addresses.

Settings

Admins can change how their organization's analytics are collected and kept under Organization → Analytics (/dash/org/settings/analytics). The analytics dashboard header also shows how long data is kept, with a link to this tab. The same settings are available through GET and PUT /api/v1/analytics/settings.

SettingWhat it does
Data retentionHow long events are kept: 90 days, 6 months or 1 year (the default). On the Enterprise plan: 2, 3, 5 or 7 years. Shortening it deletes older data at the next nightly cleanup.
Count visitors who aren't signed inCount page and course views from people without an account. On by default.
Store visitor countryRecord the country a visit comes from. On by default.
Leave admins and maintainers out of statsLeave out browsing by people who manage the organization, so your own testing doesn't skew the numbers. Off by default.

On the Enterprise plan, admins can also download every stored event as CSV with Download raw events (CSV) on the same tab, or with GET /api/v1/analytics/export/events.

Setting up analytics on a self-hosted instance

There is nothing to set up beyond the Enterprise Edition license: the database migrations create the analytics tables, and the API starts collecting as soon as the license is active. The summary and retention job runs inside the API. Set LEARNHOUSE_ANALYTICS_MAINTENANCE=false only if you run that job somewhere else.

Migrating from Tinybird

Earlier versions stored analytics in Tinybird. To keep that history (Tinybird kept 365 days), run the import once from apps/api on the API host, after the migrations:

LEARNHOUSE_TINYBIRD_API_URL=https://api.europe-west2.gcp.tinybird.co \
LEARNHOUSE_TINYBIRD_READ_TOKEN=your-read-token \
python ee/scripts/import_tinybird_analytics.py [--days 365] [--dry-run]

It works one day at a time and skips days it has already imported, so you can stop it and run it again. Unknown events and properties are dropped and IP addresses are not carried over. Once it finishes, you can remove the Tinybird variables and your Tinybird workspace.

See Environment Variables for the full list.