User Context

The user context is a crucial component in VWO's Feature Management and Experimentation SDK. It provides information about the current user, which is used for targeting and segmentation.

Usage

When calling methods like get_flag(), you need to provide a user context:

user_context = {
    id: 'user_id'
}

get_flag_response = vwo_instance.get_flag('feature_key', user_context)

ParamterTypeDescription
id
Required
StringUnique user ID for the current user. 'id' is the only required property in userContext. This ID should be a unique identifier for the current user which you need to pass to VWO. Read more here .
userAgent
Optional
StringThe userAgent object for the current user, can be used for targeting & segmentation.
ipAddress
Optional
StringIP Address of the current user, can be used for targeting & segmentation.
customVariables
Optional
hashAny additional details of the current user that you want to push to VWO can be added here as key-value pairs, can be used for targeting & pre-segmentation.

The userId is required for all SDK calls. Other properties are optional but can be used for more precise targeting and segmentation.