Docs
← Back to site

Feature flags and A/B tests

1 min readUpdated November 11, 2026

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

  1. On the Experiments tab, make a flag: its Key (used in the site’s code), the share of visitors who get it, and its Variants and their share.
  2. Optional: Only these countries, a device, or Only on pages (with * wildcards).
  3. For a test, tick Make it an A/B test and pick the goal: an event or a page visit.
  4. Use it on the website:
nq.ready(function () {
  if (nq.flag('new-checkout') === 'b') { /* show version B */ }
});

Or without code, shown only to visitors in variant b:

<div data-k-flag="new-checkout" data-k-variant="b" hidden>…</div>
  1. Turn it on from the list when the site is ready.

Results show each variant’s visits and conversion rate. Until each has about a hundred visits the page says Too early to tell. A flag keeps a random id in the browser’s local storage, so a visitor keeps their version.

The Experiments tab, with New flag and the code to use a flag

Was this helpful?