User Context

The VWOContext object must be passed as an argument whenever you call the GetFlag() or TrackEvent() functions.

VWOContext Properties

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
Dictionary<string, object>Any 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.

Usage

 var context = new VWOContext{
	Id = "unique_user_id" // Set a unique user identifier
};

// Check if a feature flag is enabled
var flag = vwoClient.GetFlag("feature_key", context);
var isFlagEnabled = flag.IsEnabled();

var trackResponse = vwoClient.TrackEvent("event_name", context);

vwoClient.SetAttribute("attribute_key", "attribute_value", context);