ConfigCat.User (ConfigCat v2.0.0) View Source
Represents a user in your system; used for ConfigCat's Targeting feature.
The User Object is an optional parameter when getting a feature flag or setting value from ConfigCat. It allows you to pass potential Targeting rule variables to the ConfigCat SDK.
Has the following properties:
identifier
: REQUIRED We recommend using a UserID, Email address, or SessionID. Enables ConfigCat to differentiate your users from each other and to evaluate the setting values for percentage-based targeting.country
: OPTIONAL Fill this for location or country-based targeting. e.g: Turn on a feature for users in Canada only.email
: OPTIONAL By adding this parameter you will be able to create Email address-based targeting. e.g: Only turn on a feature for users with @example.com addresses.custom
: OPTIONAL This parameter will let you create targeting based on any user data you like. e.g: Age, Subscription type, User role, Device type, App version number, etc.custom
is a map containing string or atom keys and string values. When evaluating targeting rules, keys are case-sensitive, so make sure you specify your keys with the same capitalization as you use when defining your targeting rules.
While ConfigCat.User
is a struct, we also provide the new/2
function
to make it easier to create a new user object. Pass it the identifier
and then either a keyword list or map containing the other properties
you want to specify.
e.g. ConfigCat.User.new("IDENTIFIER", email: "user@example.com")
Link to this section Summary
Types
Custom properties for additional targeting options.
Additional values for creating a User
struct.
The ConfigCat user object.
Functions
Creates a new ConfigCat.User struct.
Link to this section Types
Specs
Custom properties for additional targeting options.
Can use either atoms or strings as keys; values must be strings. Keys are case-sensitive and must match the targeting rule exactly.
Specs
Additional values for creating a User
struct.
Can be either a keyword list or a maps, but any keys that don't
match the field names of t:t()
will be ignored.
Specs
t() :: %ConfigCat.User{ country: String.t() | nil, custom: custom(), email: String.t() | nil, identifier: String.t() }
The ConfigCat user object.
Link to this section Functions
Specs
Creates a new ConfigCat.User struct.
This is provided as a convenience to make it easier to create a new user object.
Pass it the identifier
and then either a keyword list or map
containing the other properties you want to specify.
e.g. ConfigCat.User.new("IDENTIFIER", email: "user@example.com")