How to identify a contact in the chat?



how can I identify a visitor in the chat box? I've tried the identify API

 var _hsq = window._hsq = window._hsq || []; 
_hsq.push(["identify", { email: "${email}" }]);

but it didn't work. New chat conversations still appear as "Uknown Visitor"

I'd appreciate your help.



Hi Lukasz,

I am having the exact same issue.
I'm interested if you found a solution !



Hi @LukaszWiktor and @Romusc,

The "identify" method of the Tracking Code API only stores the identity information in the tracker; you'll need to call the "trackEvent" or "trackPageView" method to actually pass the identity info to HubSpot. Are you both subsequently calling one of these events?


Hi @Derek_Gervais,

Thanks for the hint! I was only calling identify. Now, I added trackPageView right below but it still didn't help. My code snippet looks like this:

<script type="text/javascript" id="hs-script-loader" async defer src="//"></script>
    var _hsq = window._hsq = window._hsq || [];
         email: "",

I have this user already in my Contacts but when they start a chat conversation then it shows up as "Unknown Visitor" :frowning:


Hi @LukaszWiktor,

Is this true even after a page refresh? My gut tells me that the contact identification is working, but the messages client isn't being updated with the identity info. Can you try making the association, then refreshing?


I have same issue but after refreshing it's identified in chat conversation. I have SPA in Angular 5. Any other solution for Why should i have to refresh.??


I have the same issue

<!-- Set up the path for the initial page view -->
    var _hsq = window._hsq = window._hsq || [];
        email: '{{ }}',
        id: '{{ }}'

<!-- Start of HubSpot Embed Code -->
<script type="text/javascript" id="hs-script-loader" async defer src="//"></script>
<!-- End of HubSpot Embed Code -->


Did you find any solution?


it is not possible.

The chat and analytics are two different systems and they don't communicate each other.

I had to use another chat provider :frowning:



Could you tell me which chat provider you use?


Hello, we have the exact same issue. We want to identify the conversations, but instead we only get "Unknown Visitor".

Any solution for this ?


Any updates on this?

My problem is that I need to re-identify my users upon logout / another login, but it seems that the first identify is stucked, and when the chat widget opens, the previous history shows up, and the messages goes in the name (email) of the first identified user no matter if I call again the window._hsq.push([ "identify", { email: .. } ]). What is the proper way to re-identify the chat so I could handle my single page app logout/login process?


@Derek_Gervais I'm using Forms API to submit hubspotutk along with contact name/email/ip upon login, yet I still need to refresh for the contact to be recognized by the bot.

When the user was just logged in for the first time, it's still considered an unknown visitor by the bot, and simply one more refresh would solve the issue. It has nothing to do with timing, I tried dynamically loading the script 10 seconds after the page was fully loaded upon login but I still had to refresh one more time to have the bot recognize the contact.