Automatically Associating Contacts via Live Chat for Logged-in Users


We're using the Service Hub to manage live chat.

Is there a way to automatically associate our logged-in users to a HubSpot contact instead of asking them for their email/name every time?

Intercom and other integrations have a way to use Javascript to bind them together.

Here's an example of how MouseFlow does this:

var _mfq = _mfq || [];
(function() {
var mf = document.createElement("script");
mf.type = "text/javascript"; mf.async = true;
_mfq.push(["setVariable", "user_id", "123"]);

The setVariable is what allows me to associate our users to a certain mouseflow activity.

This concept is CRUCIAL to the success of customer service. It's annoying to have to ask them who they are when they are logged in.


Hi @chadwtaylor,

You could use the identify method of the Tracking Code API when a visitor logs in to identify them. This would allow the chat to know who they are in advance:


Hii @Derek_Gervais
I have identified user using your way. But still in chat,visitor is not identified. but when i refresh page it's identified. Please help with this issue.