When you create a feature flag, you must specify a traffic type. The traffic type denotes the nature of the keys that are passed to getTreatment for that feature flag. Does the key identify a known logged-in user? A device? Is the key a uuid generated for an anonymous visitor and stored in a cookie on the visitor’s browser?
Customize traffic types to your particular use cases. You should have a traffic type for each type of key you plan to pass to getTreatment. The most commonly used traffic types are:
-
user - The key uniquely identifies a known, logged-in user. This is typically some numeric identifier that is the primary key in the table you use to store user information.
-
anonymous - The key is a randomly generated identifier, like a uuid, that identifies a visitor using a particular mobile device or browser, where it is typically stored as a cookie.
-
account - The key identifies the customer account to which the (logged-in) user belongs. This traffic type is often used to maintain consistency of behavior for all visitors from a given company or account.
It is also possible, but much less common, for a traffic type to identify something other than a visitor. For instance, a realty site might use listing as a traffic type if they wanted to explore the possibility of having a single visitor see different appearances for different property listings. For that traffic type, the code passes to getTreatment the id of the listing being displayed.
For some feture flags, you may want to randomize by sessionId rather than userId, so session is another possible traffic type. Because there will be more sessions than users, with this traffic type, you end up with a higher number of unique keys being sent to Split.
Customizing a traffic type
You can customize traffic types as needed at any time, but it is a best practice to do so during your initial account setup, taking into account your anticipated needs. Once a feature flag is created with a given traffic type, that traffic type cannot be changed, so it is important to get it right the first time.
Split allows you to have up to 10 traffic types per workspace. All environments within a workspace share the same set of traffic types. By default, a workspace has one traffic type named user. You can customize your traffic types as needed during your account setup.
To create traffic types, do the following:
- From the left hand navigation, select the the top and then Admin settings. The Workspaces page appears.
- Select the workspace that you want to edit traffic types for.
- To add more traffic types to the selected workspace, click View and then the Traffic types tab.
- Click the Actions button and then Add traffic types in the list. The Create traffic type panel appears.
- Enter a name and click Save. A new traffic type is created.
Note: Once a traffic type is created, it cannot be edited.
You can delete a traffic type from this same location in the user interface with the Delete link in the Actions column but only if it is no longer in use by any feature flags or metrics.
If you need assistance with traffic types, contct support at support@split.io.
Comments
0 comments
Please sign in to leave a comment.