HelpAlive object, for developers: identify(), reset(), setConsent(), track(), flush(), shutdown() and init(). Most apps need only the tag, identify() and reset(), as Install the script shows.
JavaScript SDK at a glance
data-api-keyis the only required attribute of the script tag. Your project key is public.- With the four queue lines in place,
identify(),reset(),setConsent()andtrack()can run before our script has loaded. - Call
init(),flush()andshutdown()only after the script has loaded. identify()tells HelpAlive who is signed in, and the agent loads only after it succeeds.reset()forgets the user at logout.data-debuglogs what HelpAlive does to the browser console while you test.
Prerequisites
- The HelpAlive tag is in your pages.
- The four queue lines from Install the script run before your first call. They let
identify(),reset(),setConsent()andtrack()run before our script has loaded. Callinit(),flush()andshutdown()only after it has loaded.
Script tag attributes
identify()
Tells HelpAlive who is signed in. The agent loads only after it succeeds.
The script refuses a call only for a missing or too-long
userId or tenantId; leaving out another required field just leaves your dashboard with less to show. A number in displayName, role or plan is turned into text. A field of the wrong type, or too long, is left out with a console warning, and the call goes on.
Returns a promise that resolves when the call has been handled. Calls run one after another, in the order you make them. Calling it again for the same user is safe. Calling it for a different user closes the previous user’s agent first. Identify users explains each field.
reset()
identify(). Activity after reset() waits in the page until the next identify().
setConsent()
Does nothing. It remains so pages written for the old consent mode don’t break, and you can remove it. See Consent.track()
Records an event of your own with the signed-in user’s activity.
Events tracked before
identify() wait in the page and are sent once it runs. Because custom properties are stored as you send them, don’t put personal data in them.
flush()
shutdown()
init() runs again. It doesn’t close an agent that is already open; call reset() for that.
init()
Most apps never callinit(): the tag’s data-api-key starts HelpAlive. Call it only if you load the script without data-api-key, after the script has loaded. Never do both, or HelpAlive starts twice.
The
capture keys are pageviews, clicks, forms, formStart, changes, errors, rage, scroll, exposure, outcomes, timing and elementContext. Each is true by default. The agent uses recent activity to understand what the user just did, which is why turning kinds off can make its answers less fitting.
init() returns a promise, and rejects if apiKey is missing.
Check it works
In the browser console on a signed-in page, runtypeof HelpAlive.init. "function" means that our script has loaded, and "undefined" means that only the queue lines have run. Add data-debug to the tag to see each call logged.
Why is HelpAlive not defined?
The errorHelpAlive is not defined means that a call ran before the queue lines. Put the four queue lines above your first call.
Why does a call do nothing?
A call does nothing when the tag has nodata-api-key, or when identify() was refused. Add data-debug to the tag and read the console. Troubleshooting lists the silent failures.
Next
Install the script
The tag, identify() and reset().
Identify users
Every field, in detail.
Troubleshooting
The failures that show no error.

