Metrics Tracking

Metrics tracking allows you to measure the impact of your features and experiments. The VWO Go SDK provides a TrackEvent() method to log custom events.

TrackEvent()

Use the TrackEvent() method to track custom events for a user:

eventName := "purchase"
eventProperties := map[string]interface{}{
    "revenue": 100,
    "itemCount": 2,
}

response, err := instance.TrackEvent(eventName, userContext, eventProperties)
if err != nil {
    // Handle error
}
fmt.Println("Event tracked:", response)

Parameter Definitions


ParameterTypeDescription
eventName
Required
StringThe unique event name you will see when creating the event in Data360. When the trackEvent() function is called, it will record a metric conversion in VWO for the given event name.
userContext
Required
map[string]interface{}Contains information about the current user, including a required unique identifier for each user. Read more about userContext here .
eventProperties
Optional
map[string]interface{}any properties of this event that you wish to pass to VWO. E.g: for a "purchase" event, some properties could be "cartValue", "currency", "shippingMethod" etc. These must be passed as key-value pairs, and the property name should exactly match what you set while creating the event in VWO > Data360>Events.

What’s Next