Identify your users with PLuG
Once you have installed PLuG, all your users who interact with the widget are created as anonymous users in the DevRev app with a random name since there is no information about the user.
For users who are logged into your website, you can identify them in PLuG so they can view their past conversations. Identifying your users also enables more personalized engagement.
In this flow, you have to generate a session token for every user who visits your website. The session token identifies the customer when they interact with the widget. The session token is generated using the application access token and customer information. It should be generated on your website’s back end since the app token needs to be kept hidden.
To identify logged-in users, follow these steps:
Generate an application access token
- In DevRev, go to Settings > Support > PLuG Tokens through the settings icon on the top-left corner.
- Under the Application access tokens panel, click New token and copy the token that’s displayed.
Ensure you copy your access token, as you will not be able to view it again.
Generate a session token
For security reasons, this call should be made from the server side so that your AAT isn’t exposed.
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.
Ensure that you follow the specified format when providing your phone number.
Pass custom attributes
To create custom attributes, see Object customization.
You can pass the custom attributes that are created as shown below:
You can pass custom traits, as shown above, not only for users
but also for workspaces
and accounts
.
If you prefer a two-level structure, where users are directly associated with an account instead of a workspace, you can provide the user_ref
and details along with the account_ref
and details.
Attributes for users
Attributes for workspaces
Attributes for accounts
Pass the session token
While initializing the PLuG widget you pass the session token for DevRev to identify this user and thereby make the widget more customized for the user and their context.
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.
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.