Appearance
identify, group, track
Run these after init().
identify
ts
identify("user-42", { role: "admin", plan: "growth" });Tells JustOneCX who the current user is. Traits merge into what the user already has. Call it on every page load to keep traits fresh.
ts
function identify(userId: string, traits?: Traits, options?: { userHash?: string }): Promise<void>;The promise resolves when the backend has saved the traits. It never rejects. Await it, then call init() again, if you need tours that depend on the new traits to appear straight away.
options.userHash is the HMAC signature of userId from your server. See Identity verification.
WARNING
identify() alone is not proof of identity. The public key is visible in your page source, so any page that has it can claim any userId. Turn on identity verification before you rely on identity for anything sensitive.
group
ts
group("acme-inc", { plan: "growth", seats: 12 });Sets the account (company, team, organisation) the user belongs to.
ts
function group(accountId: string, traits?: Traits, options?: { accountHash?: string }): Promise<void>;accountHash is the HMAC signature of accountId, computed the same way as userHash.
track
ts
track("clicked_upgrade_cta", { plan: "growth" });Records a custom event. It is tied to whatever identify and group calls came before it.
ts
function track(eventName: string, properties?: Traits): void;- Events sent before
identifyare still recorded. They have no user attached, as for any anonymous visitor. - A checklist task can wait for an event name. When
track()sends that exact name, the task completes. - A survey can use an event name as its trigger. The next matching
track()call shows the survey once.
Same person, many devices
The visitor id is per browser. If the same user calls identify("user-42") from two devices, JustOneCX links both to the same person for analytics and targeting. Chat is the exception. A conversation stays with the browser that started it, so a claimed identity cannot read another person's chat history.