Track
The Track method lets you record actions your users perform.
Usage
err := client.Track(ctx, userID, eventName, properties)
Parameters
| Name | Type | Description |
|---|---|---|
ctx | context.Context | Context for the request. |
userID | string | Unique identifier for the user. |
eventName | string | Name of the event. |
properties | map[string]interface{} | Dictionary of properties associated with the event. |
Example
properties := map[string]interface{}{
"product_id": "prod_123",
"price": 99.99,
"currency": "USD",
}
if err := client.Track(context.Background(), "user_123", "Product Purchased", properties); err != nil {
log.Println("Error tracking event:", err)
}