Skip to main content

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

ParameterTypeRequiredDescription
userIdstringYesUnique identifier for the user in your system
traitsobjectNoAdditional user properties

Common Traits

TraitTypeDescription
emailstringUser's email address (synced to HubSpot)
planstringCurrent subscription plan
companystringCompany or organization name
namestringUser'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.