Identify
Associate events with a user by calling identify() when users log in.
Basic Usage
upsell.identify('user-123', {
email: 'user@example.com'
})
With User Traits
Pass additional traits to enrich user profiles:
upsell.identify('user-123', {
email: 'user@example.com',
plan: 'free',
company: 'Acme Inc',
signupDate: '2024-01-15',
role: 'admin'
})
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userId | string | Yes | Unique identifier for the user in your system |
traits | object | No | Additional user properties |
Common Traits
| Trait | Type | Description |
|---|---|---|
email | string | User's email address (synced to HubSpot) |
plan | string | Current subscription plan |
company | string | Company or organization name |
name | string | User's full name |
When to Call Identify
Call identify() whenever a user's information changes:
// On login
function onLogin(user) {
upsell.identify(user.id, {
email: user.email,
plan: user.plan
})
}
// On plan change
function onPlanChange(user, newPlan) {
upsell.identify(user.id, {
email: user.email,
plan: newPlan
})
}
HubSpot Sync
When you call identify(), the user is created or updated as a contact in HubSpot with the provided traits.