Feature Flags
A feature flag is a named value your app reads while it runs. It works in two ways:
- A feature switch - a boolean (
trueorfalse) that turns a feature on or off without releasing a new version of the app. - Remote config - a string, a number or a JSON object that configures the app: a banner text, a price threshold, the order of a menu, a whole block of settings.
Each flag decides, person by person, which value they get. You can give a new checkout to your beta testers, then to 10% of everyone, then to everyone - and switch it off for all of them at once if something goes wrong.
Flags are listed in Campaigns: pick Feature flags in the Type filter - it lists your flags first, then your flag experiments. Each flag is a row with the people exposed to it in the list's date range (marked est. when exposures are sampled), whether it is On, Off or Archived, its values and their split (for example 2 values · 80/20) and, while an experiment runs on it, the experiment's conversions. The All tab shows flags that are on or off, Active the ones that are on, Archived the archived ones. Select a flag to open its page. See Feature flags in the list.
Feature flags are switched on for your organization by Joryio. Until they are, the Feature flags type and the Create campaign > Feature flag entry are not in Campaigns. Contact Joryio support to have them switched on. You also need permission to read flags to see them, and to change flags to create one.
Creating a flag
In Campaigns, select Create campaign > Feature flag and fill in:
- Name and Description - for the people in your team.
- Key - what the app's code asks for, for example
new_checkout. Lowercase letters, digits,_and-, up to 64 characters. The key can be changed only until the flag is turned on for the first time; after that the app depends on it, so it is locked. - Value type - Boolean, String, Number or JSON. It is fixed once the flag is created.
A new flag always starts Off - the button says Create flag (off). Creating or editing a flag never changes what a live app does until you turn it on.
Variants
The variants are the values a flag can take - between 2 and 10 of them. A boolean flag starts with on (true) and off (false); a string, number or JSON flag gets the values you type. Each variant has a key, a name and a value of the flag's type.
One variant is marked Served while the flag is off. That is the value everyone gets while the flag is off or archived - usually the current behaviour of the app.
JSON values
A JSON value is checked as you type: the editor shows an error when the text is not valid JSON, and refuses a value larger than 16 KB. Keep large content (long texts, images) elsewhere and put only its settings in the flag.
Targeting rules
Targeting rules decide who gets which variant. They are tried in order, top to bottom, and the first rule that matches the person decides - the rules below it are not looked at.
A rule's audience is built with the same audience filters as a campaign:
- In any of these segments - the person is in at least one of the chosen segments (the same live segments as your campaigns), and
- Matching these filters - any filter the campaign audience offers: attributes (for example
planequalspro, or the app's platform, version and language), events ("performedpurchasein the last 30 days"), behaviour, segments, journeys, subscriptions, e-commerce, devices and the rest. Combine them in groups with AND / OR, exactly as in a campaign, and - Exclude - a person who matches any exclude group does not match the rule.
A rule needs at least one segment or one filter. Each rule then serves a variant, or splits its audience between variants by percentage.
Visitors who have not been identified yet (no user ID) match attribute conditions only. A rule with a segment, or with any other kind of filter (an event, a subscription, a journey...), never matches them - the editor marks such a rule Identified people only.
Flags are evaluated every time an app asks for them, so a rule is kept fast: attribute conditions are checked first, and an event or segment is looked up only when the answer still depends on it. A rule can use at most 10 event, behaviour, segment or other history filters (the segment picker has its own limit of 20).
Everyone else: percentage rollout
Everyone else is everyone no rule matched. Use the slider to choose the percentage of people who get a variant - for example 10% get on and the remaining 90% get off.
The split is stable per person: the same person always lands on the same side, on every device and every time the app asks. When you raise the percentage from 10% to 20%, the people who were already in stay in, and another 10% join them.
The kill switch
The switch at the top of a flag turns it on or off at once:
- On - the rules and the rollout decide.
- Off - everyone gets the variant served while the flag is off, and no rule is evaluated.
Apps pick the change up on their next refresh: when the app starts, when it comes back to the foreground, when a person is identified, or straight away when Joryio sends the app a silent push. Turning a flag off is the fastest way to undo a release without shipping a new app version.
Setting a flag from a journey
A journey's Feature flag step sets a flag for the person who reaches it - for example, turn on a new onboarding for people who came from a campaign, or give your best customers early access.
- Set the flag for the person - choose the flag and one of its values. Choose Until removed, or For a number of hours or days (up to one year).
- Remove the value an earlier step set - the flag's rules and rollout decide for that person again.
What the person gets:
- The value set by the step comes before the flag's rules, its rollout and any experiment. A person with a value set this way is not counted in an experiment.
- The kill switch still wins: while the flag is off, everyone - these people too - gets the value served while the flag is off.
- It applies to people with a profile. A visitor the app has not identified and who has no profile is not affected.
- Nothing is pushed to the app. The app gets the new value on its next flag refresh: when it starts, comes back to the foreground, identifies a person, or within 5 minutes.
- When the time is up, the value is removed on its own. Archiving the flag removes every value journeys set for it, and a value the flag no longer has stops applying.
- Permission: adding or changing a Feature flag step, and starting a journey that has one (activate, resume, publish, re-run, roll back), needs
flags:writeon top of the journey permissions - the step changes a live flag for real people. Each start is recorded in the flag's History, and the Exposures and experiment tab names the journeys that set the flag. In a journey that has one, any change other than its name or description needsflags:writetoo - tags, status, archiving and unarchiving included - because it can change who gets the flag set. Pausing it and exiting everyone stay on the journey permissions, as the emergency stop. The one exception is removing a Feature flag step that sets a value, has no other Feature flag step after it, and is the only step in the journey that writes that flag.
The Exposures and experiment tab shows how many people have a value set by a journey step right now. The step is offered only while feature flags are switched on for your organization, and Launch Review blocks a journey whose step uses an archived flag or a value the flag no longer has. See Feature flag nodes.
Environments are workspaces
There is no separate environment setting: each workspace is an environment. Create the same key in your staging workspace and in your production workspace, and configure each one on its own. A person lands in the same rollout group in both, because the split depends only on the flag key and the person.
Exposures
An exposure is logged the first time an app reads a flag in a session - once per person, flag and variant in that session. Exposures are counted once per person, flag and variant per session: an app relaunched or a page reloaded within the same session does not add a second exposure. The Exposures and experiment tab shows how many people saw each variant per day over the period you choose. For flags without a running experiment, exposures may be sampled; the tab says at which percentage.
To chart exposures on a dashboard, add a Feature flag widget; flag experiments also appear in the dashboards' experiment grid.
Experiments
An experiment on a flag is a campaign: Campaigns > New > Flag experiment. It tests the flag's values against each other on the audience you choose, measured on the conversion goal you choose, and its results are in the campaign's analytics.
- Details - name the experiment.
- Flag values and split - pick the flag. Each variant of the experiment serves one of the flag's values - usually its off value (the current behaviour) against the new one - and gets a share of the audience. One variant is the baseline the others are compared with. An optional holdout (0% to 50%) gets the value served while the flag is off and is measured as its own group. Variants and holdout add up to 100%.
- Audience - the same audience builder as every campaign: segments, attributes, events, behaviour and the other filters. Visitors who are not identified yet enter only when the audience uses attributes alone - never with segments, events or other history.
- Conversion - the same conversion goal as every campaign: an event, with its property conditions and its window.
- Summary - Launch Review checks that the flag exists and is active, that no other experiment is running on it, that every variant serves a value the flag has, and that a goal is set.
While the experiment runs, a person in its audience gets the value of their variant every time the app asks for the flag - always the same variant for the same person, on every device. Everyone else gets the flag as it is set up. Turning the flag off still turns it off for everyone, the experiment included. One experiment runs on a flag at a time, and its flag, variants and split cannot change until it ends.
The SDKs need nothing new: they log an exposure the first time the app reads the flag in a session, as for every flag, and Joryio counts it for the experiment. The campaign's analytics show, for every variant and the holdout, the people exposed (counted from their first exposure), the people who reached the goal within its window, the rate with its 95% interval, the chance to be best, and the difference against the baseline and against the holdout with the same significance test as campaign A/B tests. The flag's value reaches the app with the reason experiment (and holdout for the holdout).
To end the experiment, pause or end the campaign: the flag serves its rules and rollout again from the app's next refresh. Roll the winning value out from the flag page.
Because an experiment changes what a flag serves, creating, editing, launching, pausing or ending one needs flags:write as well as the campaign permissions, and every such change appears in the flag's History. Reading its results needs flags:read. An experiment started on the flag page before experiments became campaigns keeps running until you stop it there, and its results stay on the flag's Exposures and experiment tab.
History
The History tab lists every change to the flag, newest first: who made it (a person, or an API key), when, what happened (created, updated, turned on, turned off, archived) and which fields changed.
Archive removes a flag that is no longer needed. Apps fall back to the default written in their code from their next refresh, a running experiment is stopped, the key becomes free for a new flag, and the history stays.
Permissions
| Permission | Allows |
|---|---|
flags:read | Seeing flags, their results and their history |
flags:write | Creating and editing flags, turning them on and off, running experiments and archiving |
Permissions are given per role - see Roles & permissions.
Reading flags in the app
Developers read flags with the Joryio SDKs. The method names are the same on Web, iOS, Android, React Native and Unity:
| Method | What it does |
|---|---|
getFlag(key, default) | The flag's value for the current person, or default when the flag does not exist or is archived |
getBoolFlag, getStringFlag, getNumberFlag, getJsonFlag | The same, typed |
getAllFlags | Every flag's value at once |
refreshFlags | Fetch the latest values now |
onFlagsUpdated | Run code whenever new values arrive |
The default in the code matters: it is what the app gets before the first answer from Joryio arrives, and after a flag is archived.
For the full reference, see the Feature Flags API.
Not available yet
Server-side local evaluation - evaluating flags inside your own backend from a downloaded copy of the rules - is planned. Today Joryio evaluates flags for the SDKs.