Skip to content

Commit

Permalink
Merge pull request #137 from helpshift/hs-widget-clearAnonymousUserOn…
Browse files Browse the repository at this point in the history
…Login

Add clearAnonymousUserOnLogin configuration inside HS widget users page
  • Loading branch information
hs-hritik authored Jun 18, 2024
2 parents a3886bd + a0cfcdb commit 86829ce
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions docs/helpshift-widget/users.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ The helpshiftWidgetConfig object accepts the following parameters:

```javascript
var PLATFORM_ID = "<YOUR_PLATFORM_ID>",
DOMAIN = "<YOUR_DOMAIN>";
APP_ID = "<YOUR_APP_ID>";
DOMAIN = "<YOUR_DOMAIN>",
APP_ID = "<YOUR_APP_ID>",
WIDGET_TYPE = "<WIDGET_TYPE>";

window.helpshiftWidgetConfig = {
Expand All @@ -95,9 +95,29 @@ Once a user logs out from your website, you should stop sending the user identif

An anonymous user is one who accesses Helpshift Widget without providing your website with a username and password. If a user identifier is not passed with the `helpshiftWidgetConfig` 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 `helpshiftWidgetConfig` 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 `helpshiftWidgetConfig` 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

```javascript
var PLATFORM_ID = "<YOUR_PLATFORM_ID>",
DOMAIN = "<YOUR_DOMAIN>",
APP_ID = "<YOUR_APP_ID>",
WIDGET_TYPE = "<WIDGET_TYPE>";

window.helpshiftWidgetConfig = {
platformId: PLATFORM_ID,
domain: DOMAIN,
appId: APP_ID,
widgetType: WIDGET_TYPE,
userId: "piano_man",
clearAnonymousUserOnLogin: true,
};
```

<Admonition type="info" title="Note">

The anonymous user will be cleared from Helpshift Widget after 7 days to make sure that the conversations by anonymous users do not persist on the browsers forever.
The `clearAnonymousUserOnLogin` functionality does not impact the logged-in user's experience at all.

</Admonition>

Expand Down Expand Up @@ -126,8 +146,8 @@ You can send the "user authentication token" along with the `userAuthToken` key

```javascript
var PLATFORM_ID = "<YOUR_PLATFORM_ID>",
DOMAIN = "<YOUR_DOMAIN>";
APP_ID = "<YOUR_APP_ID>";
DOMAIN = "<YOUR_DOMAIN>",
APP_ID = "<YOUR_APP_ID>",
WIDGET_TYPE = "<WIDGET_TYPE>";

window.helpshiftWidgetConfig = {
Expand Down

0 comments on commit 86829ce

Please sign in to comment.