Docs / Core Concepts / Gates & Targeting

Gates & Targeting

Gates control who sees a feature. Use them to gradually roll out features or target specific users.

What are Gates?

Gates are rules that determine whether a feature is enabled for a given context. Flagstack supports several gate types:

Boolean Gate

Simple on/off toggle. When enabled, the feature is on for everyone.

Actor Gate

Enable for specific users or entities. Great for beta testing with specific users.

Group Gate

Enable for users belonging to defined groups (e.g., "beta_testers", "admins").

Percentage of Actors

Enable for a percentage of users. Each user consistently sees the same state.

Percentage of Time

Enable a percentage of the time, randomly on each check.

Gate Priority

Gates are evaluated in order. If any gate returns true, the feature is enabled:

  1. Boolean gate (if true, feature is on for everyone)
  2. Actor gate (is this specific actor enabled?)
  3. Group gate (is this actor in an enabled group?)
  4. Percentage of actors (is this actor in the enabled percentage?)
  5. Percentage of time (random chance on each check)

Using Gates in Code


# Boolean check (no actor)
Flipper.enabled?(:new_feature)

# Actor-specific check
Flipper.enabled?(:new_feature, current_user)

# The user object must respond to flipper_id
class User < ApplicationRecord
  def flipper_id
    "User;#{id}"
  end
end

Tip

Use percentage of actors for gradual rollouts. The same user will consistently see the same state, making for a predictable experience.

© 2026 Flagstack. All rights reserved.