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 := vwoClient.TrackEvent(eventName, userContext, eventProperties)
if err != nil {
// Handle error
}
fmt.Println("Event tracked:", response)
Parameter Definitions
Parameter | Type | Description |
---|---|---|
eventName Required | String | The 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 | map[string]interface{} | Contains information about the current user, including a required unique identifier for each user. Read more about userContext here . |
eventProperties | 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. |
Note
The Event must already be defined in the VWO Application for this otherwise an unregistered won't get tracked in VWO application. Please refer this KB article to know more on how to create and manage events in VWO application.
Updated 7 days ago