Menu

How to identify users with the JustOneCX SDK
πŸ“°

How to identify users with the JustOneCX SDK

DEV Community: javascriptΒ·JustOneCXΒ·about 2 hours ago
#fljExq3L
#devtojavascript#devto#dev#identify#call
Long article (1118 words) β€” no AI summary yet.
Reading 0:00
15s threshold

To identify users with the JustOneCX SDK, call identify(userId, traits) after the user signs in, group(accountId, traits) to set their account, and reset() when they sign out. Traits are properties such as plan or role that merge into the profile. Add a userHash from your server so nobody can claim another person's id.

What does identify() do?

identify() tells JustOneCX who the current user is.

identify ( "user-42" , { role : "admin" , plan : "growth" } ) ;

Enter fullscreen mode

Exit fullscreen mode

Traits merge into what the user already has. Call it on every page load after login, not only on the login event, to keep traits fresh. The order relative to init() does not matter. A call made before init() is queued and runs when init() does.

The signature is:

function identify ( userId : string , traits ?: Traits , options ?: { userHash ?: string } ) : Promise < void > ;

Enter fullscreen mode

Exit fullscreen mode

The promise resolves when the backend has saved the traits. It never rejects.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.