Skip to main content
The HelpAlive script is one tag, one identify() call and one reset() call that your developer adds to your web app. This page shows how to add them by hand. It is complete on its own, so an AI coding agent can follow it without reading any other page. Settings → Setup & API Key shows the same code with your project key already filled in. It also offers two other ways in: a prompt for an AI coding agent and Google Tag Manager.

Installation at a glance

  • Put the tag in the <head> of every page, with data-api-key set to your project key.
  • Call identify() for the signed-in user right after login, and on every page load while they stay signed in.
  • Call reset() in your logout code, and keep it apart from identify().
  • If your app sends a Content Security Policy, add HelpAlive’s sources to it.
  • The tag loads in the background (async), so it doesn’t hold up your page.

Prerequisites

  • Your project key, from Settings → Setup & API Key. It is public, which means that it goes in your pages and is safe to show.
  • Access to the layout or template that every page of your app shares.
  • Your developer, about 10 minutes.
  • If your users must accept a cookie banner before tools like this run, load the tag only after they accept. See Consent.
  • Leave the tag off any page that shows data our Terms of Service say HelpAlive must not receive. Hiding the agent on Controls isn’t enough: activity is still recorded.

The install rules

Follow all of these. A missed rule usually fails without any error on screen.
  1. Put the tag in the <head> of every page, with data-api-key set to your project key.
  2. Keep the four queue lines above your first HelpAlive call.
  3. Call identify() for the signed-in user right after login, and on every page load while they stay signed in.
  4. Pass userId and tenantId as text or a number. 42 and "42" refer to the same person.
  5. Use a userId that never changes. Don’t use an email address if users can change theirs.
  6. Pass tenantId only if your app has companies, workspaces or accounts. Leave it out otherwise.
  7. Pass role, plan, displayName, email and tenantName as text. A field of the wrong type is left out. Pass createdAt as Unix time in seconds.
  8. Call reset() in your logout code, and keep it apart from identify(). Never put it straight after identify().
  9. If your app sends a Content Security Policy, add our sources, and put your nonce on our tag if your policy uses one.

How to install the script

1

Paste the tag into the head of every page

Replace YOUR_PROJECT_KEY with your key, or copy the tag from the setup page, where the key is already in it. Put it in the one file every page shares:The tag doesn’t hold up your page, because it loads in the background (async). The JavaScript reference lists the other attributes the tag accepts.
2

Tell HelpAlive who is signed in

Put this wherever your app already knows the signed-in user: right after login, and on every page load while they stay signed in. Fill it in from your app’s own user and company objects.
Then the call itself. Pick the tab that matches your app:
A tenant refers to a customer company or workspace, and its users sign in under it. tenantId and tenantName say which tenant each user belongs to. Some users have no tenant? Leave both out for them: your dashboard groups them as B2C customers.
userId and displayName are always required. In a B2B app, tenantId and tenantName are required too; in a B2C app, leave them out. role and plan are recommended: the agent reads both, and without them it sees “unknown”. The rest are optional: fill what your app has, and delete the others.The first four lines let your code call HelpAlive before our script has loaded. Our script replays the calls in order when it arrives. Identify users describes each field.Call identify() on every page load, as early as you can.
3

Forget them when they log out

Put this in your logout code, apart from the code above. Also put it wherever your app ends a session, for example where a request comes back signed out:
Never paste it straight after identify(), because it would forget the user at once and the agent would never appear. reset() also closes the agent and clears its conversation from the browser.
4

Allow our hosts in your Content Security Policy, if you have one

Most apps don’t send a Content-Security-Policy header and can skip this step. If yours does, add these sources to it without removing anything:
If your script-src uses a nonce, put the page’s nonce on the HelpAlive tag, the same way your other scripts get theirs:
No style-src change and no 'unsafe-inline' are needed. Content Security Policy explains each source.

TypeScript

If the code from step 2 is in a TypeScript file, tell TypeScript about HelpAlive once, in a .d.ts file your project includes:
Then give the queue line’s rest argument a type:

Single-page apps

  • HelpAlive records page views by itself when your router changes the address. You don’t call anything on route changes.
  • One identify() per page load is enough. Calling it again with the same details is safe.
  • If a different user signs in without a page reload, call identify() with the new user. HelpAlive closes the previous user’s agent first.

Check it works

1

Sign in to your app

Use a test account and open a page. Wait a few seconds.
2

Look for the agent

The round chat button appears in a corner once the agent is switched on on Controls and has published docs from Train. Until then, the steps below still tell you the install works.
3

Open the setup steps

Once the tag is live, sign in to your app and click around, then come back to Settings → Setup & API Key. Step Add HelpAlive to your app gets a check once it sees a signed-in person. Setup & API Key explains each step.
To see what HelpAlive does on a page, add data-debug to the tag while you test. It logs to the browser console. Remove it before you ship.

Troubleshooting

  • The build with the tag isn’t live where you’re testing yet.
  • The tag has no data-api-key. Without it, nothing starts and nothing is logged.
  • Your Content Security Policy blocks the script. Open the browser console and look for an error that names helpalive.js or Content Security Policy.
  • An ad blocker or privacy extension blocks it. Try a private window with extensions off.
The script is on your pages, but identify() isn’t running, or it was refused. Check that it runs after login and on every page load, and that the four queue lines come before it. Check that userId is not empty. Add data-debug to the tag to see the reason in the console.
The agent appears only for signed-in users it is switched on for, on Controls. A page that was already open picks up a change within a minute or a few page loads. Troubleshooting covers the other causes.

Still stuck?

Email support@helpalive.com. To help us answer quickly, include:
  • the address of a page where the problem happens, and the browser you used;
  • which steps on Settings → Setup & API Key have a check, and what step 1’s line says;
  • what the browser console shows with data-debug on the tag.
Your project key is public, so you can include it. Never send your signing secret.

Next

Identify users

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

Verify users

Optional, and recommended before you open the agent to all your users.

Troubleshooting

The failures that show no error.
Last modified on October 12, 2026