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, withdata-api-keyset 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 fromidentify(). - 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.- Put the tag in the
<head>of every page, withdata-api-keyset to your project key. - Keep the four queue lines above your first
HelpAlivecall. - Call
identify()for the signed-in user right after login, and on every page load while they stay signed in. - Pass
userIdandtenantIdas text or a number.42and"42"refer to the same person. - Use a
userIdthat never changes. Don’t use an email address if users can change theirs. - Pass
tenantIdonly if your app has companies, workspaces or accounts. Leave it out otherwise. - Pass
role,plan,displayName,emailandtenantNameas text. A field of the wrong type is left out. PasscreatedAtas Unix time in seconds. - Call
reset()in your logout code, and keep it apart fromidentify(). Never put it straight afteridentify(). - 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
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:
- B2B: users belong to tenants
- B2C: users have no tenant
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 If your No
Content-Security-Policy header and can skip this step. If yours does, add these sources to it without removing anything:script-src uses a nonce, put the page’s nonce on the HelpAlive tag, the same way your other scripts get theirs: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:
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.
data-debug to the tag while you test. It logs to the browser console. Remove it before you ship.
Troubleshooting
Step 1 still says Not on your pages yet
Step 1 still says Not on your pages yet
- 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.jsorContent Security Policy. - An ad blocker or privacy extension blocks it. Try a private window with extensions off.
Step 1 stays on Waiting for someone to sign in
Step 1 stays on Waiting for someone to sign in
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.Everything is working, but the agent doesn't appear
Everything is working, but the agent doesn't appear
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-debugon the tag.
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.

