A/B testing

Guide: running a test

Each test is one entry in the config block at the top of ab.js. Every action below is an edit to that entry, merged to main, and live within about five minutes.

Register

  1. In Webflow, build both versions and add data-ab-test="<id>" plus data-ab-variant="<variant>" to each. Publish. Nothing changes for visitors: with no entry in ab.js every version would show, so add the entry first.
  2. Add the entry with status: 'draft':
    'pricing-pro-cta': {
      status: 'draft',
      paths: ['/pricing'],
      variants: { 'control': 50, 'talk-to-sales': 50 }
    }
  3. QA each variant with ?ab=pricing-pro-cta:control and ?ab=pricing-pro-cta:talk-to-sales.

Start

  1. Set status: 'running' and merge.
  2. Check that Experiment Viewed arrives in the Segment debugger with the right experiment_id and both variation_id values.
  3. Note the start date in your experiment doc; the dashboard should filter from that date.

Pause

Because the paused state shows the control to everyone, a visitor who was in the variant sees the page change if you pause. That is the safer default when something is broken.

Stop

  1. Set status: 'stopped' and winner: '<variant>'. Everyone sees the winner right away.
  2. In Webflow, delete the losing version and remove the two attributes from the winner. Publish.
  3. Remove the entry from ab.js.

Keep steps 2 and 3 in that order: removing the entry first would show both versions at once.

Rules that keep the data clean

Never change weights or add a variant while a test is running. Stop it and start a new one with a new id.

Never reuse an id; old cookies would carry over old assignments.

One test per element. Two tests can run on the same page if they touch different elements.