Open source  /  Implementation guide

Open-source implementation · Conversion Rate Optimization

Run conversion experiments on open source

What this is. A build-it-yourself path to the same outcome, made from open-source parts you host. It does not publish 5 Kings’ internal method, client data, or any third party’s confidential information — and it says plainly where the open-source path is weaker than a specialist service.

In one paragraph

Most conversion ‘optimisation’ is a design opinion with a screenshot. An experiment needs four things: a measurable event, a random assignment, a sample-size decision made before you look, and a result you are willing to publish even when it is flat. All four are buildable on open source, and the statistics are not the hard part.

What you end up with

  • An event schema that captures the actual decision, not just a pageview
  • Server-side or edge assignment so the test cannot be blocked by a client script
  • A pre-registered sample size and stopping rule per experiment
  • A results register, including the experiments that failed, kept where the team can read it

The reference stack

Every project below is open source and self-hostable. Licences are the ones the project publishes today; check them against your own distribution model before you ship, because a licence can change and an AGPL project has obligations a MIT project does not.

LayerOpen-source projectLicenceWhat it does for you
Feature flags + experimentsGrowthBookMIT (core)Self-hosted assignment, Bayesian and frequentist engines, and a results view that does not hide the sample size.
Product analyticsPostHogMIT (core)Event capture, funnels, session replay for diagnosing why a variant lost.
Server-side assignmentYour own edge / middlewaren/aAssign in the request path, so ad blockers and ITP cannot silently bias the split.
Statisticsstatsmodels / SciPyBSD-3-ClausePower calculation before the test, sequential testing correction if you must peek.
Event QAGreat Expectations or dbt testsApache-2.0Assert that the event fires once per session, has the right properties, and has not silently stopped.
ReportingMetabaseAGPL-3.0One dashboard per experiment: assignment counts, conversion by variant, confidence interval, and the pre-registered stopping rule.

Build it

1. Fix the event schema before the first test

Name the events once, define the properties, and write them down. Every experiment afterwards depends on that schema; a rename mid-programme orphans history. Include a synthetic test event so you can prove the pipeline works.

2. Choose the metric and the guardrail together

A primary metric (the thing you are trying to move) plus one or two guardrails (revenue per session, refund rate, page error rate). Without a guardrail you will eventually ‘win’ an experiment by making checkout slightly worse.

3. Compute the sample size and write the stopping rule down

Power calculation from your baseline rate and the minimum effect worth acting on. Then commit: ‘we stop at N or after 21 days, whichever comes first, and we do not look before 70%’. This single document is what separates an experiment from a vibe.

from statsmodels.stats.power import NormalIndPower
from statsmodels.stats.proportion import proportion_effectsize

effect = proportion_effectsize(0.032, 0.036)   # 3.2% -> 3.6%
n = NormalIndPower().solve_power(effect, power=0.8, alpha=0.05, ratio=1)
print(round(n))  # per variant, ~13,000 sessions

4. Assign on the server, not in the browser

Browser-side assignment is easier and more biased: ad blockers, consent walls and slow networks all correlate with the variant. Assign in middleware, set a first-party cookie, and log the assignment server-side so the denominator is real.

5. Verify the split before reading results

Sample ratio mismatch is the first diagnostic. If assignment is 51/49 on a 50/50 test with 10,000 sessions, the test is broken and the result is meaningless. Run this check automatically and refuse to plot until it passes.

6. Report flat results as results

A register of 30 experiments where 24 were flat is more useful than 6 wins with no denominator. Publish the effect size and the confidence interval, not just ‘won/lost’.

Acceptance checks

If you cannot verify a claim, it is not a finding. These are the checks that close the work; each one can be run by somebody who did not build it.

Acceptance checkHow to verify it
Assignment is server-side and loggedAssignment events exist in the warehouse with a variant and a timestamp, independent of the browser beacon.
Sample ratio mismatch within toleranceChi-square on assignment counts; block reporting on failure.
Every experiment has a pre-registered sample size and stopping ruleTicket field required before launch.
Guardrail metrics did not regressDashboard compares guardrails per variant with confidence intervals.
Event QA passes on the day of launchdbt/GE assertions on event count, uniqueness and required properties.
Results are in the register within a week of stoppingRegister row exists with effect, interval, decision and follow-up.

Effort and cost

Estimate
Skill neededIntermediate: SQL, one scripting language, and a willingness to read a power calculation
Build time2–3 days for flagging + event schema, 1–2 days for server-side assignment, 1 day for the dashboard
Running costUnder an hour per experiment once the pipeline exists; the waiting is calendar time
What you must hostOne 4 GB VPS for GrowthBook + PostHog + Metabase, or run the flags only and use existing analytics.

What open source does not give you

The honest half of the comparison. Each of these is a reason somebody buys the service instead of building it, and pretending otherwise would make the rest of this page worthless.

  • You need traffic. Below a few thousand converting sessions a month, most tests cannot reach significance and the honest answer is to fix obvious defects rather than experiment.
  • Open-source experimentation tools give you statistics, not ideas. Hypotheses come from customer conversations, support tickets and sales calls.
  • Client-side tests are still easier on many stacks; if you must use one, accept a biased denominator and say so in the report.
  • Cross-device and long-consideration purchases break short-window attribution. The experiment can be valid and the business conclusion still wrong.
  • A/B results decay. A winner from last year is a hypothesis for this year, not a fact.

Scope only, stated so you can compare it with the build above.

  • Hypothesis quality, drawn from the support and sales conversation rather than from a heuristic checklist
  • Implementation of the variant at the platform’s own layer, with a rollback
  • A results read that separates a real effect from a seasonal or tracking artefact

Sources and further reading

What this page does not include. This guide documents an open-source implementation of the same outcome. It deliberately leaves out 5 Kings’ internal playbooks, client data, vendor terms and unpublished method: we publish what any competent team can reproduce, and we do not publish what belongs to a client or to a contract. Where a step depends on a decision only your business can make, the guide says so instead of guessing.

Take it with you

Run conversion experiments on open source

The full guide as an A4 PDF: the reference stack with licences, the build steps, the acceptance checks and the honest limits — in one file you can hand to an engineer or print for a planning session.

PDF · A4 · no email required · free to redistribute with attribution

Open-source Guides & PDFs