Skip to content
Floodgate Docs

The User Object

With Floodgate you have the ability to customize the value of a feature flag on a per user basis. To achieve this you need to create a User Object for each of your application users. The User Object contains data about the current user which in turn you can use in your flag configuration.

About the User Object

The User Object is the way Floodgate uniquely identifies your users. As a developer you can add as much data as you require to the user objects you create. This data can then be used by product managers to decide what feature values are served to the specific users.

Security and User Data

Even though Floodgate requires data about your users to allow for targeted flag evaluations, this data is never sent to the Floodgate servers. All evaluations are done locally on your servers within your application.

User Object Properties

Every User Object you create needs to be initialized with a unique id to identify the user. The table below shows the properties that make up the User Object.

PropertyRequiredTypeDescription
User IdYesstringEvery user is required to be assigned a unique id. This could be a database id or the users email address for example. Session IDs or UUIDs are suited best.
EmailNostringYou can optionally set the users email address if you would like to evaluate against specific users emails.
Custom AttributesNoArrayEach user can have any number of custom attributes assigned to them. This is a very powerful feature of Floodgate as it gives you the flexibility to evaluate flags against any data element that may belong to your users. The SDK you are using will determine the exact data type of the custom attributes.

Creating User Object Example


var customAttributes = new Dictionary() {
  { "name", "Peter Parker" },
  { "subscription", "Gold" },
  { "country", "UK" },
  { "role", "Admin" }
};

User user = new User("a-unique-id")
{
  Email = "spiderman@marvel.com",
  CustomAttributes = customAttributes
};