PrismCue

Documentation · Feature flags

Turn a feature on
for the visitors you choose.

A feature flag answers one question for each visitor: is this feature on for them? You add the check to your website once. After that you change the flag in PrismCue, without a deploy. A flag has no goal and no results.

Step 1

Create a flag

In the dashboard’s Feature flags page, or in the extension, create a flag with a key such as new_checkout. The key is used in your code and cannot be changed later, so choose it with care.

A new flag starts off, so it changes nothing until you turn it on. When it is on, choose who sees it: every visitor, or the visitors who match up to three conditions. Conditions are the same as for a test: device, new visitor, traffic source, your own visitor properties, and saved segments. Then choose a rollout percentage for the matching visitors.

Step 2

Add the check to your website

Your workspace script already includes the flag API. Use it after the script has run, and keep a sensible default for when PrismCue is not available:

const prismcue = window.prismcue;

if (prismcue) {
  await prismcue.ready();
  renderCheckout(prismcue.isEnabled('new_checkout'));
} else {
  renderCheckout(false);
}

If the script is blocked or missing, window.prismcue does not exist, and your page should show the feature as off. Keep that case working: a flag is a convenience, not a safety control.

Step 3

Wait for the decision

ready() resolves when the first decisions are made, or when the configuration cannot be loaded. It does not wait for your tests to apply. Until then, isEnabled() returns false with the reason not_ready.

isEnabled(key) and getFlagDecision(key) are synchronous reads of the current decisions. They never make a request.

To react when a decision changes, for example after your page sets a new property, subscribe:

const stop = prismcue.onFlagsChanged((keys) => {
  if (keys.includes('new_checkout')) renderCheckout(prismcue.isEnabled('new_checkout'));
});

The listener is called with the keys of the decisions that changed, after all decisions are updated. Call the returned function to stop listening.

Step 4

Reasons

getFlagDecision(key) returns the decision with a reason, and the names of any visitor properties that were missing or had the wrong type. It never returns property values.

ReasonEnabledMeaning
enabledyesThe visitor matches the audience and is in the rollout.
offnoThe flag is off.
audience_missingnoThe visitor does not match, and a property the audience uses is missing.
audience_mistypednoThe visitor does not match, and a property has the wrong form, such as text where a number is expected.
audience_no_matchnoThe visitor does not match the audience.
rollout_excludednoThe visitor matches the audience but is outside the rollout percentage.
not_readynoThe decisions are not made yet. Wait for ready().
unavailablenoThe configuration could not be loaded.
unknown_flagnoThe page asked for a key that does not exist in this workspace.
invalid_confignoThe flag is not valid, for example because it uses a segment that no longer exists.

Step 5

Changing a flag

  • Turning a flag off overrides every earlier decision. It applies on the next page load.
  • Raising the rollout keeps visitors who were already in it. Lowering it removes only those above the new percentage.
  • The same visitor keeps the same answer while the flag and its audience stay the same.
  • Each flag decides independently, so two flags may both include the same visitor.
  • A saved segment used by an on flag cannot be changed, and a segment used by any flag cannot be deleted. Turn the flag off, or remove the segment from the flag, first.

Step 6

Limits

  • Open pages do not update. A change reaches a page the next time it loads. Do not rely on a flag to stop a feature on a page that is already open.
  • Not for security or payments. The decision is made in the visitor’s browser, where it can be inspected and changed. Protect confidential features on your server.
  • No usage numbers. PrismCue does not count how many visitors got true or false, or whether your code used the result.
  • Workspace-wide. A flag is not tied to a page address. Your code decides where it is used.
  • No schedule. You turn a flag on or off yourself.

Privacy

What PrismCue receives

Visitor property values stay in the visitor’s browser, and the flag decision is made there. Each visitor’s random browser identifier decides their place in a rollout. PrismCue does not receive or store property values or decisions.

The audience you save is part of the flag’s configuration. A rule that names a specific value, such as an email address, is delivered to every visitor’s browser with the flag. See the PrismCue privacy policy.

Next step

Create your first flag.

Add the check to your site once, then control the feature from PrismCue.

Read the setup guide