Features · A/B tests

A/B tests and feature flags on any client website.

Turn part of a site on for some visitors with a feature flag. Give it a goal, and it becomes an A/B test that compares each version on that goal, in the same place as the rest of your stats.

new-checkoutGoal: Purchase
A · current3.1%2,410 visits
B · new4.0%2,388 visits

Illustration with example numbers

Two tools in one

A flag, then a test when you want one.

Feature flag

Turns part of a website on for some visitors. Roll out a new section to a share of visitors, or only in some countries, before everyone sees it.

A/B test

A flag with a goal. Each variant’s visits are compared on that goal, an event or a page visit, so you see which version converts better.

Set up a test

Five steps, one line of code.

  1. 1Make a flagOn the Experiments tab: its key, the share of visitors who get it, and its variants and their share.
  2. 2Choose who sees itOptional: only some countries, a device, or only some pages, with * wildcards.
  3. 3Make it a testTick Make it an A/B test and pick the goal: an event or a page visit.
  4. 4Use it on the websiteOne line of JavaScript, or no code at all with an HTML attribute.
  5. 5Turn it onFrom the list, when the site is ready.
Feature flags and A/B tests in the docs →
With code
nq.ready(function () {
  if (nq.flag('new-checkout') === 'b') {
    /* show version B */
  }
});
Without code: shown only to variant b
<div data-k-flag="new-checkout"
     data-k-variant="b" hidden>…</div>

Results

Know which version wins, and when to wait.

Visits and conversion rate

Each variant’s visits, and how many reached the goal.

Too early to tell

Shown until each variant has about 100 visits, so you don’t call a winner on a handful.

Each visitor keeps their version

A random id in the browser’s local storage, not a cookie, so a returning visitor sees the same variant.

Good to know

Off until you need it, and honest about storage.

Feature flags and A/B tests are an extra feature: off until you turn them on, per website, and their code only loads where used. Flags keep a random id in the browser’s local storage, so a privacy policy should mention it when they’re on. Plans can include or leave them out for clients.

Questions

A/B test questions

Something else? Ask us.

What’s the difference between a flag and an A/B test?

A flag turns part of a website on for some visitors. Give it a goal and it becomes an A/B test, comparing each variant’s visits on that goal.

Do I need to write code?

No. You can use one line of JavaScript, or an HTML attribute that shows an element only to visitors in one variant.

What can the goal be?

An event, such as a purchase or a sign-up, or a page visit.

When can I trust the result?

The results say Too early to tell until each variant has about 100 visits.

Does it use cookies?

No. A flag keeps a random id in the browser’s local storage, so a visitor keeps their version. Your privacy policy should mention it while flags are on.

Test it before you ship it.

Unlimited websites, every feature, one license.