One of the first things you'd want to do with your feature gates is to create a set of rules. These rules will determine the targeting on who gets to see the new feature and who doesn't.
Statsig allows you to create these rules with a rich set of targeting conditions. You can choose to test your new feature to a small set of users sliced by targeting conditions like: User ID, Email, Country, Operating System, Browser, and more.
When you create a new Feature Gate, you will see an empty rules section like this:
By default, this gate will always return false, meaning the feature will be off because there are no rules that are passing. Let's go ahead and add our first rule by clicking on the "+ Add Rule" button.
You will see a 'Add New Rule' dialog where you an see a list of conditions to choose from:
Go ahead and check out all the conditions. For this exercise, let's pick "Email" as our condition. Now you'll notice that we have a set of 'operators' like Any of, None of, Contains any of, etc.
These operators allow us to specify how the condition should be evaluated.
Let's say we want to launch this feature to only employees of your company. Usually employees will have a domain email address, so let's assume they all happen to have email domain example.com.
Now select "Contains any of" in the operator field, and type "@example.com" in the Values textbox and hit tab to create the new token.
Let's also give a short name for this rule. The filled out form should look like this:
Now hit 'Add Rule' button and make sure you save these updates by hitting the 'Save Changes' button at the top right of the rules section.
Any time you make changes to the Rules section, you will need to commit the changes by hitting the 'Save Changes' button.
Congratulations you have now declared that this new feature is only visible to your employees.
Let's verify that the rules are actually working. To do that we conveniently put a "Test Gate" console at the bottom of the Rules.
You should see something like this:
The object that you can edit in the console represents a user with a set of properties. In this case, the system has automatically filled out 'email'.
Let's go ahead and set a value for the email field in the user object. Try typing 'email@example.com' for the email value, like this:
The console should now indicate that the gate is passing, which means the feature is available for firstname.lastname@example.org.
You can try any other email. As long as the domain matches 'example.com', the feature will be available (PASS), and not otherwise (FAIL).
Feel free to add more rules and test them using the console. Happy Feature Gating!