diff --git a/fern/docs/pages/sdks/web/user-identity.mdx b/fern/docs/pages/sdks/web/user-identity.mdx index 22ab62cb..ed33083c 100644 --- a/fern/docs/pages/sdks/web/user-identity.mdx +++ b/fern/docs/pages/sdks/web/user-identity.mdx @@ -120,3 +120,46 @@ const sessionToken = '' })})(); ``` + +## Identify users without session token + +You can also pass the identifiers in the `plugSDK.init` option without generating the session token. + + +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. + + + +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. + + +```jsx +window.plugSDK.init({ + 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 + } +}) +``` +