Users
Track and manage users on Helpshift PC Widget - Unity.
How to identify and manage users
Logged in users
Overview
If your Unity app has logged-in users, we strongly recommend including user identifiers (UserId
and/or UserEmail
) in the config object during initialization. Doing so enables Helpshift Agents to offer a personalized support experience to your users, regardless of the device they are using. Passing the user identifiers to Helpshift PC Widget also ensures that a user's conversations are available only to them when they log in.
What to provide as user identifiers
You can set the UserId
and/or UserEmail
to identify your users. We highly recommend using a UserId
to identify your users. If you use emails to identify your users, you must pass them with the UserEmail
field with in the config object during initialization.
The following rules apply when you use both, UserId and UserEmail.
- When looking the user up in the Helpshift system, the priority of
UserId
is higher than that ofUserEmail
. - When the
UserId
matches that of an existing user, the existing user's email gets updated, if the email is provided. - When the
UserEmail
matches that of an existing user, the following rules apply:- If the
UserId
doesn't exist for the user matched by the email, then theUserId
would be added to that user, if aUserId
is provided. - If the
UserId
already exists for the user matched by the email, then a new user would be created, if a differentUserId
is provided.
- If the
How to provide user's information
The Helpshift PC Widget config object accepts the following parameters:
Parameter | Description | Important considerations |
---|---|---|
userName | A user's name. Provide the name you'd like the Agents to use to address the user. If you don't have the user's name in your systems, you may leave it blank. The Identity Bot, if enabled, will ask the user for their name. If you provide a value for the name, then the Identity Bot will not ask the user for their name again. | Max length – 255 characters. Values longer than this will be truncated. |
UserId | A user's unique identifier. The UserId values must be unique for your users, i.e. you should not use the same UserId for different users. | 1. The max length is 750 characters. Values longer than this will result in the creation of an anonymous user. 2. Leading/trailing spaces are not allowed. Spaces within the UserId value are allowed, though. UserId values with leading/trailing spaces will result in the creation of an anonymous user.3. The UserId value is case-sensitive, e.g. "1abc" is different than "1ABC".4. Do not provide an email address as the UserId . If you use email addresses to identify users, provide them with UserEmail .5. If you are using UserId as well as UserEmail , ensure that UserId is present in all subsequent pages. Providing just the email may return another user's conversations, if multiple profiles have the same email. |
UserEmail | A user's email address. If you don't know the user's email, you may leave it blank. The Identity Bot, if enabled, will ask the user for their email. If you provide a value for the email, then the Identity Bot will not ask the user for their email again. | 1. The email should be in a valid format, e.g. "foobar@example.com". Invalid emails will result in the creation of an anonymous user. 2. Leading/trailing spaces are not allowed. Emails with leading/trailing spaces will result in the creation of an anonymous user. 3. The email value is case insensitive, e.g. "foobar@example.com" is same as "FOObar@Example.Com". |
- In order to create a logged-in user in Helpshift, the use of either
UserId
orUserEmail
is required. - All the parameter values should be of type string. Integer and decimal values are invalid.
Example Embed Code
using HSWidgetLibrary
var config = new HelpshiftConfig
{
Domain = "<YOUR_DOMAIN>",
PlatformId = "<YOUR_PLATFORM_ID>",
AppId = "<YOUR_APP_ID>",
UserId = "<USER_ID>",
UserEmail = "<USER_EMAIL>",
};
// Pass the configuration to the initialize API
Helpshift.Initialize(Application.streamingAssetsPath, config);
Logging the users out
Once a user logs out from your unity app, you should set the UserId
and UserEmail
to empty string in config and sending the user identifiers with the HelpshiftConfig
object to ensure that other users can't view this user's conversations. After you log a user out, only the conversations started by anonymous users using that specific browser will be visible.
Anonymous Users
Overview
An anonymous user is one who accesses Helpshift PC Widget without providing a username and password. If a user identifier is not passed with the HelpshiftConfig
object at the time on initialization, Helpshift assumes that the end user is an anonymous user, i.e. is not currently logged in. Similarly, if a user identifier is passed with the HelpshiftConfig
object, then the end user is assumed to be a logged-in user.
If your use-case involves multiple logged-in or anonymous users using the same device, ideally you wouldn't want the conversations to be shared across logins. In this case, you should use the ClearAnonymousUserOnLogin
option with the HelpshiftConfig
object at the time of initialization. If you set ClearAnonymousUserOnLogin
to true
, then anonymous users will be cleared from Web Chat whenever a new user logs in. Once cleared, such users, and their conversations, are not fetched again.
Example Embed Code
using HSWidgetLibrary
var config = new HelpshiftConfig
{
Domain = "<YOUR_DOMAIN>",
PlatformId = "<YOUR_PLATFORM_ID>",
AppId = "<YOUR_APP_ID>",
UserId = "<USER_ID>",
UserEmail = "<USER_EMAIL>",
ClearAnonymousUserOnLogin = true,
};
// Pass the configuration to the initialize API
Helpshift.Initialize(Application.streamingAssetsPath, config);
The ClearAnonymousUserOnLogin
functionality does not impact the logged-in user's experience at all.