Identify
The Identify method lets you tie a user to their actions and record traits about them.
Usage
err := client.Identify(ctx, userID, traits)
Parameters
| Name | Type | Description |
|---|---|---|
ctx | context.Context | Context for the request. |
userID | string | Unique identifier for the user (e.g., database ID). |
traits | map[string]interface{} | Dictionary of attributes associated with the user. |
Traits
Traits are pieces of information you know about a user, such as their email, name, or plan. The Conviso recognizes some special traits:
emailfirstName/first_namelastName/last_namephoneavatarcreatedAt/created_at
Example
traits := map[string]interface{}{
"email": "[email protected]",
"firstName": "Alice",
"lastName": "Smith",
"plan": "Pro",
"created_at": "2023-01-01T12:00:00Z",
}
if err := client.Identify(context.Background(), "user_123", traits); err != nil {
log.Println("Error identifying user:", err)
}