APIs & Integrations

flukeout
Member

Identified contact with email still "Unknown Visitor" in chat Inbox

So, we are having trouble identifying a users who use the chatbot we set up. First, we are running the following code to identify the user in the console after loading the site.

 

var _hsq = window._hsq = window._hsq || [];
_hsq.push(["identify", {
  email: "test12345@test1234589.co.uk"
}]);
_hsq.push(['trackPageView']);
window.HubSpotConversations.widget.refresh();

 

This successfully creates this user under Contacts, but when we use the chat widget after doing this, the user always comes through as "Unknown User" in our Inbox.

 

This chatbot is running on "platform.activestate.com"

 

What are we missing?

4 Replies 4
mikek604
Participant

Identified contact with email still "Unknown Visitor" in chat Inbox

Just adding some additional context in support of @flukeout:


We want the HubSpot chatflow to associate with the Contact record created via HubSpot API endpoint (external web form) or import - based on their email address.

Our website <platform.activestate.com> creates a new contact in HubSpot using the Contacts API when that visitor fills our web form to "create a free account". This API sync maps to the default email address property. Additionally, we've back-filled by importing a number of contacts, mapped to the same properties.

 

Our HubSpot tracking code is running on <platform.activestate.com>, which should include both website tracking and the chatflow functionality.

However, when said visitor has filled the form and/or logged into our site, and the chatflow comes up, it does not associate that visitor with the contact record created via our API sync (or import), but instead still shows them as an "Unknown Visitor". There seems to be some disconnect between HubSpot's tracking and our contacts created by "offline" sources.

To try to resolve this, we implemented the code mentioned by @flukeout but it's not working.

0 Upvotes
WendyGoh
HubSpot Employee
HubSpot Employee

Identified contact with email still "Unknown Visitor" in chat Inbox

Hi @mikek604 and @flukeout,

 

When looking to identify visitor before they open a chat so that contact wouldn't show up as "Anonymous Visitor", you can refer to this community thread: https://community.hubspot.com/t5/APIs-Integrations/How-to-identify-a-contact-in-the-chat/m-p/272830/... where @cbarley shared an example code:

 

function onConversationsAPIReady() {
    var _hsq = window._hsq = window._hsq || [];
    console.log("ready")
    _hsq.push(["identify",{
    	email: "test@testing.com"
    }]);
    _hsq.push(['trackPageView']);
    setTimeout( () => {
      console.log("refresh")
      window.HubSpotConversations.widget.refresh();
    }, 1000)
  }

  function sendIdentify(){
    if (window.HubSpotConversations) {
     onConversationsAPIReady();
    } else {
      window.hsConversationsOnReady = [onConversationsAPIReady];
    }
  }
0 Upvotes
flukeout
Member

Identified contact with email still "Unknown Visitor" in chat Inbox

Hi Wendy, thanks for the response and the link to the post. 

 

In our experience, which is echoed by serveral replies there, the solution provided in the sample code isn't working. We've tried that specific snippet as well as manually running the commands in our browser console (the code we posted).

 

The code works in that it does correctly crate a user with the email we provide and the trackPageview event, which we see in the Contacts section of Hubspot. However, when that user types into the chat and sends a message, they are still "Unknown Visitor" which is the issue at hand.

 

We'll kick it around a bit more today in case we've missed something obvious. If you know of any other things to try please let us know. Cheers!

0 Upvotes
WendyGoh
HubSpot Employee
HubSpot Employee

Identified contact with email still "Unknown Visitor" in chat Inbox

Hi @flukeout,

 

Following up on our discussion, our team can confirm that if you've implemented the identifytrackPageView, and HubSpotConversations.widget.refresh() methods @cbarley10 outlines here and are still seeing some chats as "Unknown Visitors", it is currently an expected behavior. 

 

My colleague Isaac further explained the reason behind this behavior and you can read about it here (The accepted solution by Isaac).

0 Upvotes