Skip to content

Commit e0f0e08

Browse files
authored
frontend user-identity method (#232)
* Update user-identity.mdx * Update user-identity.mdx Add beta message with limitations
1 parent 74f2f02 commit e0f0e08

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

fern/docs/pages/sdks/web/user-identity.mdx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,46 @@ const sessionToken = '<SESSION_TOKEN>'
120120
})})();
121121
</script>
122122
```
123+
124+
## Identify users without session token
125+
126+
You can also pass the identifiers in the `plugSDK.init` option without generating the session token.
127+
128+
<Callout intent="note">
129+
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.
130+
</Callout>
131+
132+
<Callout intent="warning">
133+
This method is currently in beta and comes with the following limitations:
134+
- Unverified users cannot be converted or merged into verified users.
135+
- An external reference used by an unverified user cannot be reused for any other user.
136+
</Callout>
137+
138+
```jsx
139+
window.plugSDK.init({
140+
app_id: '<your_unique_app_id>',
141+
identity: {
142+
user_ref: string;
143+
user_traits?: { // optional
144+
custom_fields?: object; // optional
145+
display_name?: string; // optional
146+
email?: string; // optional
147+
phone_numbers?: string[]; // optional
148+
}
149+
}
150+
})
151+
```
152+
153+
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.
154+
155+
```jsx
156+
window.plugSDK.updateIdentity({
157+
user_traits: {
158+
custom_fields?: object; // optional
159+
display_name?: string; // optional
160+
email?: string; // optional
161+
phone_numbers?: string[]; // optional
162+
}
163+
})
164+
```
165+

0 commit comments

Comments
 (0)