← All integration guides

Feature flags

Roll a feature out to a percentage of users without a second SDK.

Create a flag

Open Flags in the dashboard. Each flag has a key, an on/off switch, and a rollout percentage from 0 to 100. Free plans cannot create flags. Starter includes 3. Premium includes 25.

A flag is on for someone only when it is enabled and a stable hash of their user id plus the flag key falls inside the rollout percentage. The same person always sees the same result. Turning the flag off turns it off for everyone.

Browser

Call analytica.isFeatureEnabled after the tracker has initialized. getFlags(userId) loads the full map when you want every key at once. Both methods return a promise.

The fetch is asynchronous and is not part of pageview or track, so it does not delay the beacon. The map is cached in sessionStorage for that project and user, which keeps later checks off the network for the rest of the tab session. The tracker stays under 3 KB gzip.

const enabled = await analytica.isFeatureEnabled("new_checkout");

const flags = await analytica.getFlags("user_42");
if (flags.new_checkout) {
  // show the new checkout
}

Node

Pass a user id, or call identify first and omit it. The read is separate from track and does not delay event delivery.

const on = await client.isFeatureEnabled("new_checkout", "user_42");
const flags = await client.getFlags("user_42");

Python

The Python client uses the same evaluation URL. is_feature_enabled and get_flags match the browser methods.

on = client.is_feature_enabled("new_checkout", "user_42")
flags = client.get_flags("user_42")