Skip to main content
Installing HelpAlive in a plain HTML or server-rendered app means adding one script tag to the layout every page uses, having your server print an identify() call for the signed-in user, and calling 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.

HTML install at a glance

  • The tag goes in the <head> of your base layout, the template every page shares.
  • Your server prints the identify() call into the page, only when someone is signed in.
  • User values go into the page through your framework’s JSON helper, never pasted into the script by hand.
  • reset() runs in the browser when the user submits your logout form.
  • With Turbo, htmx or a similar library, keep the identify script in the body so it runs on each visit.

Before you start

  • Your project key, from Settings → Setup & API Key. It is public, which means that 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, just inside <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, and 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. Call reset() in the browser just before it leaves, in the same layout:
Use your own logout form’s selector. For a logout link, listen for click on the link instead. If your app ends sessions on its own, for example after a timeout, also print HelpAlive.reset() on the page that tells the user they were signed out.
If your app sends a Content Security Policy, add HelpAlive’s sources and put your page’s nonce on the tag and on the inline scripts above, as Install the script shows in its last step.

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. Pasting values into the script by hand would let a value someone typed into your app, such as a company name, run code in other people’s browsers.

Does it work with Turbo or htmx?

Yes. The tag in the head loads once and stays as 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.

Verify users

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

Google Tag Manager

Install without changing your templates.

Troubleshooting

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