Google Tag Manager install at a glance
- The HelpAlive tag loads the script on All Pages. Your project key is public and safe to put in a tag.
- Your app pushes
helpalive_identifyright after login and on every page load while the user stays signed in. - Your app pushes
helpalive_resetin its logout code, apart from the identify push. - A second tag passes the identify fields on to HelpAlive, and a third tag forgets the user at logout.
- Each
helpalive_field you push needs a Data Layer Variable with the same name.
Prerequisites
- Tag Manager is already on every page of your app.
- Your project key, from Settings → Setup & API Key. It is public and safe to put in a tag.
- A developer who can add two
dataLayer.pushcalls to your app: one after login, one at logout. - If your users must accept a cookie banner before tools like this run, fire the tag only after they accept. See Consent.
- Don’t fire the tag on 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.
How to set up HelpAlive in Tag Manager
1
Add the HelpAlive tag
In Tag Manager, go to Tags → New → Custom HTML. Paste this, replace The setup page shows this tag with your key already in it, under Google Tag Manager.
YOUR_PROJECT_KEY with your key, and set the trigger to All Pages.2
Push the signed-in user to the data layer, from your app
Run this right after login, and on every page load while the user stays signed in. Keep every line: for a value this user doesn’t have, push The user id and the person’s name are always required. In a B2B app, the tenant id and name are required too; push
undefined. Tag Manager keeps the last value pushed, so a line you leave out would carry the previous user’s value over.undefined for users with no tenant. A tenant refers to the company, workspace or account a user belongs to in your app.3
Create a Data Layer Variable for each field
In Variables → New → Data Layer Variable (version 2), create one variable for each
helpalive_ name you push, with the same name. This is needed because Tag Manager won’t publish a tag that names a variable you haven’t created.4
Add a second tag that passes it on
Add another Custom HTML tag, triggered by the custom event The first line means that this tag can run before the HelpAlive script has loaded. Keep it.
helpalive_identify. Delete the lines for fields you don’t push.5
Forget the user at logout
In your logout code, and wherever your app ends a session, push this. Keep it apart from the identify push.Then add a third Custom HTML tag, triggered by the custom event
helpalive_reset:6
Submit the container
Press Submit in Tag Manager to publish the three tags.
Verify users through Tag Manager
Once your server makes user tokens (see Verify users), pass the token through the data layer. Create a Data Layer Variable namedhelpalive_user_token, then add these lines:
Content Security Policy
If your app sends a Content Security Policy, it must already allow Tag Manager’s Custom HTML tags. Add our sources as well:Check it works
- Open Tag Manager’s Preview mode on your app and sign in. The
helpalive_identifyevent fires the identify tag. - Open your app, sign in and click around, then come back to Settings → Setup & API Key. Step Add HelpAlive to your app gets a check.
- Log out in Preview mode and check that
helpalive_resetfires the reset tag.
Why won’t Tag Manager publish the identify tag?
Tag Manager won’t publish the identify tag because the tag names a variable you haven’t created. Create eachhelpalive_ Data Layer Variable, or delete its line from the tag.
Why does the identify tag fire, but nobody is recognized?
Nobody is recognized because the user id reached HelpAlive empty. Check that your push setshelpalive_user_id before the helpalive_identify event, and that the Data Layer Variable has exactly that name. To see the reason, add s.setAttribute("data-debug",""); to the loader tag while you test, and read the browser console.
Why does the previous user’s chat stay open after logout?
The previous user’s chat stays open because thehelpalive_reset push or its tag is missing. Add both, and publish the container.
Next
Identify users
What each field means.
Verify users
Sign each user id on your server.
Troubleshooting
The failures that show no error.

