Identity API
Tell Tugus who the visitor is, so their activity can be tied to a customer you know.
Associate a visitor's activity with a customer you already know.
tugus.identify(user)
Call this as soon as you know who the visitor is — after login, on a newsletter
sign-up, or when the checkout e-mail is entered. Pass the identifiers you have;
Tugus remembers them and adds them to the visitor's following events, so you
don't have to repeat them on every track() call.
Use the same external_id you already use for that customer (for example
your shop's customer number), so the data lines up with your other systems.
// After login
tugus.identify({ external_id: '12345' })
// Or with an e-mail (e.g. a newsletter opt-in)
tugus.identify({ email: 'ada@example.com' })| Field | Type | Description |
|---|---|---|
external_id | string | Your customer ID (e.g. shop customer no.) |
email | string | E-mail address |
phone | string | Phone number |
emails / phones / external_ids | string[] | Multiple identifiers per person |
first_name / last_name | string | Optional profile details |
city / state / zip / country | string | Optional profile details |
Pass plaintext values — hand over only what you already have. Tugus applies
your configured consent settings. Identity is set only by your explicit
identify() call; the SDK never reads form fields on its own.
tugus.getIdentity()
Read the identity you set.
const id = tugus.getIdentity()
// → { external_id: '12345', email: 'ada@example.com' }tugus.reset()
Clear the stored identity — call it on logout or on a shared device so the next person starts fresh.
tugus.reset()tugus.setClientId() / getClientId()
Set or read the device-level ID Tugus uses for the visitor — e.g. to reuse an ID
you already assign yourself. Prefer identify() when you actually know the
customer.
// Set the client ID after login
tugus.setClientId('user_12345')
// Read the current client ID
const cid = tugus.getClientId()tugus.getUtm() / clearUtm()
// Read the UTM data from the current session
const utm = tugus.getUtm()
// → { source: 'google', medium: 'cpc', campaign: 'de_brand_q4' }
// Reset UTMs (e.g. on logout)
tugus.clearUtm()