Skip to content

frontend user-identity method #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions fern/docs/pages/sdks/web/user-identity.mdx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [EkLine]

Where possible, do not structure sentences in future tense. Use present tense instead. (EK00005)

Ensure you copy your access token, as you will not be able to view it again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [EkLine]

Avoid using the term 'CRM'. (EK25015)

Using the `rev_info` method, you can generate and recognize a user within the DevRev system by providing relevant user details. This method enables you to convey information systematically, ensuring alignment between your DevRev CRM and the structured data model. For information regarding terminologies, click [here](https://devrev.ai/docs/product/grow).

Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,46 @@ const sessionToken = '<SESSION_TOKEN>'
})})();
</script>
```

## Identify users without session token

You can also pass the identifiers in the `plugSDK.init` option without generating the session token.

<Callout intent="note">
This frontend user identification, by its nature, is not secure as the data is transmitted through the client side. It is recommended to use the session token method to securely identify users.
</Callout>

<Callout intent="warning">
This method is currently in beta and comes with the following limitations:
- Unverified users cannot be converted or merged into verified users.
- An external reference used by an unverified user cannot be reused for any other user.
</Callout>

```jsx
window.plugSDK.init({
app_id: '<your_unique_app_id>',
identity: {
user_ref: string;
user_traits?: { // optional
custom_fields?: object; // optional
display_name?: string; // optional
email?: string; // optional
phone_numbers?: string[]; // optional
}
}
})
```

You can add or update the data in `user_traits` by using the `updateIdentity` method on the PLuG SDK. Attached is a sample code snippet for the same.

```jsx
window.plugSDK.updateIdentity({
user_traits: {
custom_fields?: object; // optional
display_name?: string; // optional
email?: string; // optional
phone_numbers?: string[]; // optional
}
})
```

Loading