Skip to main content

Track

The Track method lets you record actions your users perform.

Usage​

err := client.Track(ctx, userID, eventName, properties)

Parameters​

NameTypeDescription
ctxcontext.ContextContext for the request.
userIDstringUnique identifier for the user.
eventNamestringName of the event.
propertiesmap[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)
}