Skip to main content
To install HelpAlive in a Vue app, add one script tag to index.html. Then call identify() from a watcher on your signed-in user, and call reset() in your logout action. This page covers Vue 3 apps built with Vite, and Nuxt apps, which load the tag from nuxt.config instead.

Before you start

  • Your project key, from Settings → Setup & API Key. It is public, so it is safe to put in your front-end code.
  • The store or composable that holds the signed-in user, for example a Pinia useAuthStore().
  • About 10 minutes.

How to install HelpAlive in Vue

1

Add the tag to index.html

Open index.html at the root of your project and paste the tag before </head>:
index.html
Replace YOUR_PROJECT_KEY with your key.
2

Add the helper module

Create src/helpalive.ts. It queues calls made before the script has loaded, and the script replays them in order when it arrives:
src/helpalive.ts
3

Call identify() from a watcher on the user

In your root component, watch the signed-in user. immediate: true makes the watcher run on page load as well as after login:
src/App.vue
Fill the fields from your own user and company objects, and delete the ones your app doesn’t have. Identify users describes each field.
4

Call reset() in your logout action

Put resetUser() in the action that signs the user out:
src/stores/auth.ts
Also call it wherever your app finds out a session has ended, for example in an HTTP interceptor that sees a 401. Don’t call it from the watcher when user is null. The user is null for a moment on every page load. A reset() in the watcher would close the agent and clear the user’s conversation from the browser each time.
If your app sends a Content Security Policy, add HelpAlive’s sources as Content Security Policy shows.

How to install HelpAlive in Nuxt

1

Add the tag in nuxt.config

Add the script to app.head, so Nuxt puts it in the head of every page:
nuxt.config.ts
2

Call identify() from a client-only plugin

Copy the helper module above to utils/helpalive.ts. Then create a plugin whose name ends in .client.ts, so it runs only in the browser:
plugins/helpalive.client.ts
Call resetUser() in your logout function, as in the Vue steps above.

Why does the identify code need to run only in the browser?

HelpAlive runs in the browser, and window does not exist during server rendering. In Nuxt, the .client.ts suffix keeps the plugin out of the server. The helper module also uses window only inside its functions, so importing it on the server is safe.

Do I need to tell HelpAlive about route changes?

No. HelpAlive records a page view whenever Vue Router changes the address, in history mode and in hash mode. There is nothing to call in a navigation guard.

What happens when another user signs in without a reload?

The watcher calls identify() with the new user when auth.user changes. HelpAlive closes the previous user’s agent first, then opens a fresh one for the new user. You should still call reset() in your logout action, before the new user signs in.

Check that it works

Sign in to your app with a test account, then open Settings → Setup & API Key on the dashboard. The first step, Add HelpAlive to your app, gets a check once HelpAlive has seen your page and a signed-in user. Check it works explains each step. To see what HelpAlive does on a page, add data-debug to the tag while you test. Remove data-debug before you ship.

Verify users

Verifying users is optional and recommended. Your server signs a token for the signed-in user, and your app passes it to identify() in place of userId and tenantId. Verify users shows how to create the signing secret and sign the token in your server’s language. Add the token to what your current-user endpoint returns, for example /api/me. Send that response with Cache-Control: no-store. Then pass the token in the watcher from step 3:
src/App.vue
In Nuxt, add the token where your server returns the current user, and make the same change in plugins/helpalive.client.ts. HelpAlive calls refreshUserToken when a token expires, so you need it only if your tokens have an exp. If your endpoint can’t make a token, for example after an error, pass userId and tenantId as in step 3. Keep resetUser() in your logout action: it also forgets the token.

Next

Identify users

Every identify() field, switching company, and logout.

Verify users

Add a signed token so nobody can use the agent as someone else once Only allow verified users is on.

Troubleshooting

When the agent doesn’t appear.
Last modified on November 26, 2026