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 tag and calls with your project key already filled in. It also offers two other ways to install: a prompt for an AI coding agent and Google Tag Manager.

Prerequisites
- A web app people sign in to. Will it work with my app? lists what HelpAlive supports.
- Your project key, from Settings → Setup & API Key. It is public and 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, because activity is still recorded.
The install rules
Follow all of these. If you miss one, the agent usually doesn’t appear.- Put the tag in the
<head>of every page, withdata-api-keyset to your project key. - Keep the four queue lines from step 2 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"are the same person. - Use a
userIdthat never changes. Don’t use an email address if users can change theirs. - Pass
tenantIdandtenantNameonly if your app has companies, workspaces or accounts. Then both are required. - Pass
role,plan,displayName,emailandtenantNameas text, andcreatedAtas Unix time in seconds. A field of the wrong type is left out. - Call
reset()in your logout code, never straight afteridentify(). - If your app sends a Content Security Policy, add our sources and keep what it already allows. With a nonce, put it on our tag and on the script that calls
identify(). Without one, load the step 2 code from a.jsfile.
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 with the key already in it. There is no npm package: this tag is the whole install, in every framework. Put it in the one file every page shares:The JavaScript reference lists the tag’s other attributes.
2
Tell HelpAlive who is signed in
Put this in your app’s own code, wherever it already knows the signed-in user. Run it right after login, and as early as you can on every page load while they stay signed in. Fill it in from your app’s own user and company objects. It can’t go in a head or custom-code setting.Then the call itself. Pick your app’s tab:
- B2B: users belong to tenants
- B2C: users have no tenant
A tenant is a customer company, workspace or shared account (a household, a family plan), and its users sign in under it. For users with no tenant, leave out
tenantId and tenantName: your dashboard groups them as B2C customers.role and plan are recommended: the agent reads both to fit its answers to the user. Fill the optional fields your app has, and delete the others. Identify users describes each field.The first four lines queue your calls until our script loads. It then replays them in order.3
Forget them when they log out
Put this in your logout code, separate from the code above. Also put it wherever your app ends a session, for example where a request fails because the user is signed out:Never paste it straight after
identify(): 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 Add each source to the directive of the same name. If your policy has no If your policy uses a nonce, put the page’s nonce on the HelpAlive tag and on the script that calls If your policy has no nonce and no
Content-Security-Policy header and can skip this step. If yours does, add these sources without removing anything:script-src or connect-src, add the sources to its default-src instead. A new script-src or connect-src line would replace default-src and block your app’s own scripts or requests. For example, default-src 'self'; becomes:identify(). Add it the same way you do for your other scripts:'unsafe-inline', it blocks inline scripts. Put the code from steps 2 and 3 in a .js file served from your own site, or in your app’s own bundle.You don’t need a style-src change or 'unsafe-inline'. Content Security Policy explains each source.TypeScript
If the step 2 code is in a TypeScript file, declare HelpAlive once in a.d.ts file your project includes:
.ts file in the same folder has. TypeScript skips a .d.ts file named after a .ts file next to it.
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 call nothing on route changes.
- One
identify()per page load is enough. Repeating it 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.
Can’t edit your app’s login code?
In a prebuilt app, you may be able to add a script but not change its login or logout code. If people sign in and out there without a page load, check who is signed in yourself:- Check again on every route change, and when the tab comes back into view.
- Call
reset()when nobody is signed in. - Call
identify()when the user is different.
<script> tag. Keep the four queue lines from step 2 above it, and add the fields your app has, as in step 2. Test it on a page that changes route without a reload before you publish it.
Check it works
1
Sign in to your app
Use a test account and open a page.
2
Look for the agent
The round chat button appears in a corner once you publish docs on Train and switch the agent on in Controls. Until then, the next step still confirms the install.
3
Open the setup steps
Click around your app, then come back to Settings → Setup & API Key. Step Add HelpAlive to your app gets a check once HelpAlive sees a signed-in person. Setup & API Key explains each step.
data-debug to the tag. The browser console then shows what HelpAlive does. Remove data-debug 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.
- The tag has no
data-api-key. Without it, nothing starts and nothing is logged. - Your Content Security Policy blocks the script. Look in the browser console for an error naming
helpalive.jsorContent Security Policy. - An ad blocker or privacy extension blocks it. Try a private window with extensions off.
Step 1 says no signed-in user yet
Step 1 says no signed-in user yet
A first sign-in shows within seconds. Press Check again on the setup page.If it still says so, 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;
- the four queue lines come before it;
userIdis not empty.
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 you switch it on for. You do this on Controls. An open page picks up a change the next time it loads, after at most 30 seconds. Troubleshooting covers the other causes.
Still stuck?
Email support@helpalive.com with:- a page address where the problem happens, and your browser;
- which steps on Settings → Setup & API Key have a check, and what step 1’s line says;
- the browser console output 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
When the agent doesn’t appear.

