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:

err := vwoClient.SetAttribute("attribute-key", "attribute-value", userContext)
if err != nil {
    // Handle error
}

Parameter

Type

Description

attributeKey Required

String

The 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