Attributes

Attributes allow you to update user properties dynamically. These can be used for user segmentation and targeting in your VWO campaigns.

SetAttribute()

Use the SetAttribute() method to set a custom attribute for a user:

attributeKey := "membership_level"
attributeValue := "premium"

err := instance.SetAttribute(attributeKey, attributeValue, userContext)
if err != nil {
    // Handle error
}

ParameterTypeDescription
attributeKey
Required
StringThe key of the attribute to set
attributeValue
Required
interface{}The value of the attribute.
userContext
Required
map[string]interface{}Contains information about the current user, including a required unique identifier for each user. Read more about userContext here .

What’s Next