Skip to main content
Installing HelpAlive in a plain HTML or server-rendered app takes 3 steps. You add one script tag to the layout every page uses. Your server prints an identify() call for the signed-in user. You call reset() when the user logs out. This page shows the pattern in plain HTML, Rails, Django and Laravel. The same pattern works in any server that renders HTML templates, such as ASP.NET, Express or PHP.

Before you start

  • Your project key, from Settings → Setup & API Key. It is public, so it is safe to put in your pages.
  • Access to your base layout, for example application.html.erb, base.html or app.blade.php.
  • About 10 minutes.

How to install HelpAlive in a server-rendered app

1

Add the tag to your base layout

Paste the tag before </head> in the layout every page uses:
Replace YOUR_PROJECT_KEY with your key.
2

Print identify() for the signed-in user

In the same layout, at the start of <body>, print the identify call when someone is signed in. The first lines let the call run before our script has finished loading, and our script replays it when it arrives. Pick your framework:
app/views/layouts/application.html.erb
Leave out tenantId and tenantName in a B2C app, where users have no company or workspace. Also delete the fields your app doesn’t have. Identify users describes each field.
3

Call reset() when the user logs out

Logout in a server-rendered app is usually a form or a link that goes to the server. In the same layout, call reset() in the browser before it leaves the page:
Use your own logout form’s selector. For a logout link, listen for click on the link instead. Some apps also end sessions on their own, for example after a timeout. If yours does, print HelpAlive.reset() on the page that tells the user they were signed out. Print the first lines from step 2 above it, so the call can run before our script has loaded.

With a Content Security Policy

If your app sends a Content Security Policy, add HelpAlive’s sources as Content Security Policy shows, keeping what your app already allows. If your policy uses a nonce, put the page’s nonce on the tag and on the inline scripts above. If your policy has neither a nonce nor 'unsafe-inline', it blocks the inline scripts above. Instead, print the user’s details as a JSON data block, which the browser never runs. Then move the script lines into a file on your own site:
/js/helpalive-identify.js
In Laravel, print @json($helpaliveUser) inside the data block. In Rails, print the same json_escape(...) value. Django’s json_script already writes the data block, so only its script moves to the file. Move the reset() listener from step 3 into a file too.

Why print user values with a JSON helper?

Names and emails come from your users, so a value can contain characters that end a script early, such as </script>. Rails’s json_escape, Django’s json_script and Laravel’s @json turn each value into safe JavaScript. Without these helpers, a value someone typed into your app, such as a company name, could run code in other people’s browsers.

Does it work with Turbo or htmx?

Yes. The tag in the head loads once and stays while Turbo or htmx swaps the page. Keep the identify script in the body, as above, so it runs again on each visit. A repeated call with the same details is harmless. HelpAlive records a page view by itself each time the address changes.

Does the agent appear on signed-out pages?

No. The script can load on every page, but the agent appears only after identify() has run for a signed-in user. Your login page and marketing pages stay as they are.

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, and remove it before you ship.

Next

Verify users

Sign each user id on your server, with Ruby, Python and PHP examples.

Google Tag Manager

Three Custom HTML tags and two data layer pushes.

Troubleshooting

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