← Back to portfolio TaskFlow — PostHog Product Analytics Pipeline preview
Stack
PythonPostHogFastAPIStreamlitpandas / matplotlibpytest / ruffDocker
Impact
  • Typed event catalog (single source of truth) + PostHog capture/identify/group with PII scrubbing
  • Feature flag → onboarding A/B variant; A/B analysis with chi-square, uplift, Wilson CI + SRM check
  • Day-N cohort retention, time-to-convert, revenue/LTV, first-feature → upgrade conversion
  • The same metrics as SQL (BI / interview reference) + interactive Streamlit dashboard
  • CI (pytest + ruff) + Docker + render.yaml for one-click deploy
Source View on GitHub → Repo is private — available on request Updated: Sep 15, 2026

TaskFlow — PostHog Product Analytics Pipeline

Context

Most analytics portfolios start with a ready-made CSV. This project starts earlier — with instrumenting an application — and goes through the whole cycle: generate traffic, capture events, analyze, dashboard, and deploy.

Data & Method

Pipeline

app/                Demo SaaS (FastAPI + Jinja2): routes + server-side capture
  analytics/        typed event catalog · PostHog wrapper (PII scrub) · feature flag
scripts/            simulate_events.py — 30 days of realistic funnel traffic
analysis/           funnel · cohort · A/B · revenue/LTV · time-to-convert · feature-usage · SQL
dashboard/          interactive Streamlit dashboard

What it demonstrates

  • Instrumentation: a typed event catalog as the single source of truth; server-side capture; PII scrubbing.
  • A/B: feature flag → onboarding variant; chi-square, uplift, Wilson CI, SRM check.
  • Metrics: funnel, Day-N cohort retention, time-to-convert, revenue/LTV, first-feature → upgrade.
  • SQL mirror: the same metrics as SQL — a reference for BI and interviews.
  • Engineering: pytest + ruff in CI, Dockerfile, render.yaml for one-click deploy.

Findings

The value is in the completeness of the cycle. The typed event catalog and PII scrubbing are the discipline that separates production instrumentation from a demo: events are defined in one place, PII does not leak, and the metrics reproduce in both Python and SQL.

Impact

  • Full lifecycle — instrument → generate → analyze → dashboard → deploy in one repo.
  • 7 analyses — funnel, cohort, A/B, revenue/LTV, time-to-convert, feature-usage, SQL mirror.
  • A/B with SRM check — chi-square + uplift + Wilson CI.
  • Production-ready — CI, Docker, render.yaml.

Documentation

Case study

Problem

Product analytics is usually shown on a cleaned CSV. The hard part — instrumenting a real app, capturing the right events without PII leaks, getting them into a tool, and turning raw events into decisions — stays invisible.

Approach

Built a demo SaaS (FastAPI + Jinja2) with server-side PostHog capture over a typed event catalog (single source of truth), a PostHog wrapper that scrubs PII, and a feature flag driving an onboarding A/B. A simulator generates 30 days of realistic funnel traffic; analysis scripts turn the pulled events into funnel, cohort retention, A/B (chi-square + uplift + Wilson CI + SRM check), revenue/LTV, time-to-convert, and feature-usage → upgrade. The same metrics are written as SQL for BI/interview use, plus an interactive Streamlit dashboard.

Result

One repo covers the full analytics lifecycle — instrument, generate, analyze, dashboard, deploy — with CI (pytest + ruff), Docker, and render.yaml for one-click deploy. The typed event catalog and PII scrubbing show the discipline that separates a demo from production instrumentation.

7 Analyses
yes A/B SRM-check
pytest + ruff CI
Docker + Render Deploy

Charts

Source: github.com/NikitaBoyarkin/posthog-saas-analytics: data/raw/events.jsonl (committed snapshot, 14,764 events / 2,000 users) re-analyzed with `uv run python analysis/report.py` -> reports/posthog_analysis_report.md (funnel, retention, A/B, revenue); daily-active-users computed with pandas from data/raw/events.jsonl

Activation funnel

Sequential funnel: each step counts only users who performed it after the previous one. 32.8% of signups reach activation (core action) and 5.3% reach upgrade.

signup_started: 2000 (100% от макс.) signup_started 2000 signup_completed: 1709 (85.5% от макс.) signup_completed 1709 onboarding_completed: 1082 (54.1% от макс.) onboarding_completed 1082 core_action_performed: 656 (32.8% от макс.) core_action_performed 656 upgrade_completed: 107 (5.4% от макс.) upgrade_completed 107
Key takeaways
  • The sharpest drop-off is at upgrade_completed: only 16.3% convert from the previous step, and just 107 of 2,000 users (5.3%) upgrade.
  • Onboarding loses 36.7% of users who completed signup (1,709 -> 1,082), and 60.6% of those who finish onboarding perform the core action.

Day-N cohort retention (D0–D6)

Cohort = signup day; retained = share of the cohort that fired core_action_performed on day N. Shown are the 14 most recent cohorts over the first 7 days; every value is real.

2026-09-01 2026-09-02 2026-09-03 2026-09-04 2026-09-05 2026-09-06 2026-09-07 2026-09-08 2026-09-09 2026-09-10 2026-09-11 2026-09-12 2026-09-13 2026-09-14 D0 D1 D2 D3 D4 D5 D6 2026-09-01 · D0: 32.7% 2026-09-01 · D1: 9.1% 2026-09-01 · D2: 14.5% 2026-09-01 · D3: 10.9% 2026-09-01 · D4: 9.1% 2026-09-01 · D5: 14.5% 2026-09-01 · D6: 12.7% 2026-09-02 · D0: 40.3% 2026-09-02 · D1: 12.9% 2026-09-02 · D2: 12.9% 2026-09-02 · D3: 14.5% 2026-09-02 · D4: 9.7% 2026-09-02 · D5: 16.1% 2026-09-02 · D6: 17.7% 2026-09-03 · D0: 37.9% 2026-09-03 · D1: 18.2% 2026-09-03 · D2: 16.7% 2026-09-03 · D3: 13.6% 2026-09-03 · D4: 10.6% 2026-09-03 · D5: 13.6% 2026-09-03 · D6: 12.1% 2026-09-04 · D0: 37% 2026-09-04 · D1: 14.8% 2026-09-04 · D2: 14.8% 2026-09-04 · D3: 20.4% 2026-09-04 · D4: 20.4% 2026-09-04 · D5: 9.3% 2026-09-04 · D6: 13% 2026-09-05 · D0: 33.9% 2026-09-05 · D1: 16.1% 2026-09-05 · D2: 7.1% 2026-09-05 · D3: 7.1% 2026-09-05 · D4: 8.9% 2026-09-05 · D5: 8.9% 2026-09-05 · D6: 8.9% 2026-09-06 · D0: 41.5% 2026-09-06 · D1: 18.9% 2026-09-06 · D2: 20.8% 2026-09-06 · D3: 13.2% 2026-09-06 · D4: 18.9% 2026-09-06 · D5: 17% 2026-09-06 · D6: 22.6% 2026-09-07 · D0: 34% 2026-09-07 · D1: 14.9% 2026-09-07 · D2: 8.5% 2026-09-07 · D3: 8.5% 2026-09-07 · D4: 17% 2026-09-07 · D5: 23.4% 2026-09-07 · D6: 10.6% 2026-09-08 · D0: 40% 2026-09-08 · D1: 22.2% 2026-09-08 · D2: 22.2% 2026-09-08 · D3: 20% 2026-09-08 · D4: 15.6% 2026-09-08 · D5: 8.9% 2026-09-08 · D6: 0% 2026-09-09 · D0: 41.4% 2026-09-09 · D1: 12.1% 2026-09-09 · D2: 15.5% 2026-09-09 · D3: 15.5% 2026-09-09 · D4: 20.7% 2026-09-09 · D5: 0% 2026-09-09 · D6: 0% 2026-09-10 · D0: 41.8% 2026-09-10 · D1: 19.4% 2026-09-10 · D2: 20.9% 2026-09-10 · D3: 13.4% 2026-09-10 · D4: 0% 2026-09-10 · D5: 0% 2026-09-10 · D6: 0% 2026-09-11 · D0: 41.5% 2026-09-11 · D1: 24.5% 2026-09-11 · D2: 17% 2026-09-11 · D3: 0% 2026-09-11 · D4: 0% 2026-09-11 · D5: 0% 2026-09-11 · D6: 0% 2026-09-12 · D0: 38.9% 2026-09-12 · D1: 22.2% 2026-09-12 · D2: 0% 2026-09-12 · D3: 0% 2026-09-12 · D4: 0% 2026-09-12 · D5: 0% 2026-09-12 · D6: 0% 2026-09-13 · D0: 33.3% 2026-09-13 · D1: 1.8% 2026-09-13 · D2: 0% 2026-09-13 · D3: 0% 2026-09-13 · D4: 0% 2026-09-13 · D5: 0% 2026-09-13 · D6: 0% 2026-09-14 · D0: 41.2% 2026-09-14 · D1: 3.9% 2026-09-14 · D2: 0% 2026-09-14 · D3: 0% 2026-09-14 · D4: 0% 2026-09-14 · D5: 0% 2026-09-14 · D6: 0% 0 100%
Key takeaways
  • Retention is low and jittery: D0 runs 32.7–41.8%, but by D1 it falls to 1.8–24.5% — users are active irregularly rather than daily.
  • The matrix is triangular from D4 onward: cohorts 2026-09-13 (D1 = 1.8%) and 2026-09-14 (D1 = 3.9%) show the weakest retention among the newest cohorts.

Onboarding A/B test: control vs new_onboarding

Shorter onboarding vs control, measured by completion among users who started. Completion is 55.9% for control vs 70.8% for new_onboarding.

0 500 1000 control — started: 857 857 new_onboarding — started: 852 852 control — completed: 479 479 new_onboarding — completed: 603 603 control new_onboarding Variant Users started completed
Key takeaways
  • Relative uplift in completion is +26.6% (55.9% -> 70.8%), chi-square 40.10, p = 0.0000 — the effect is statistically significant.
  • The 95% CI for the difference (new - control) is [8.4, 21.2] pp, and the sample-ratio-mismatch check passes (p = 0.9037): the split is balanced, so the variant can be rolled out.

Daily active users (DAU)

Unique users per day across the 30-day traffic snapshot. The final days (2026-09-14, 2026-09-15) are the tail of the simulation window with partial days.

0 100 200 300 dau 2026-08-16 — dau: 69 2026-08-17 — dau: 63 2026-08-18 — dau: 74 2026-08-19 — dau: 86 2026-08-20 — dau: 90 2026-08-21 — dau: 92 2026-08-22 — dau: 114 2026-08-23 — dau: 134 2026-08-24 — dau: 125 2026-08-25 — dau: 137 2026-08-26 — dau: 147 2026-08-27 — dau: 150 2026-08-28 — dau: 161 2026-08-29 — dau: 164 2026-08-30 — dau: 170 2026-08-31 — dau: 198 2026-09-01 — dau: 179 2026-09-02 — dau: 180 2026-09-03 — dau: 217 2026-09-04 — dau: 215 2026-09-05 — dau: 200 2026-09-06 — dau: 229 2026-09-07 — dau: 227 2026-09-08 — dau: 236 2026-09-09 — dau: 230 2026-09-10 — dau: 242 2026-09-11 — dau: 271 2026-09-12 — dau: 284 2026-09-13 — dau: 267 2026-09-14 — dau: 70 2026-08-16 2026-08-17 2026-08-18 2026-08-19 2026-08-20 2026-08-21 2026-08-22 2026-08-23 2026-08-24 2026-08-25 2026-08-26 2026-08-27 2026-08-28 2026-08-29 2026-08-30 2026-08-31 2026-09-01 2026-09-02 2026-09-03 2026-09-04 2026-09-05 2026-09-06 2026-09-07 2026-09-08 2026-09-09 2026-09-10 2026-09-11 2026-09-12 2026-09-13 2026-09-14 Date Active users
Key takeaways
  • DAU grew from 69 (2026-08-16) to a peak of 284 (2026-09-12) — a 4.1x increase over the 30-day window.
  • Growth is steady, with a median day-over-day change of +8%; the final values of 70 (2026-09-14) and 4 (2026-09-15) are a partial-day tail of the simulation.

See also

Connection map

Projects, posts and topics connected to this one. Hover a node to see its name; click to open.