APIs & Integrations

matheusmurta
Participant

How to identify contact in chat widget using a single-page application?

SOLVE

I need to identify the users that use the chat in my single-page application. 

 

I tried to use _hsq.push (["identify", {...}]); as indicated in the documentation
sending the contact property information as user.email for example

note: user creation and contact properties update is working correctly.


but this function it did not identify my user in chat as expected.

 

How i can identify active users in the hubspot chat in my single-page application ?

0 Upvotes
1 Accepted solution
matheusmurta
Solution
Participant

How to identify contact in chat widget using a single-page application?

SOLVE
document.cookie = 'hubspotutk=;Path=/;Domain=.MyDomain.com.br;expires=Thu, 01 Jan 1970 00:00:01 GMT;';

only this way I was able to remove data from old users, I appreciate the attention.

View solution in original post

0 Upvotes
4 Replies 4
WendyGoh
HubSpot Employee
HubSpot Employee

How to identify contact in chat widget using a single-page application?

SOLVE

Hi @matheusmurta,

 

I hope all is well with you 🙂 

 

The 'identify' function of the Tracking Code API only stores the data in the tracker, so the data can only be passed when either of these two functions: trackPageView or trackEvent is call. Just to be sure, are you calling one of these functions?

 

matheusmurta
Participant

How to identify contact in chat widget using a single-page application?

SOLVE

@WendyGoh 
Yes, my problem actually is that apparently it sometimes does not clear the information of an old user who entered the system even using the features as in the example below:

 


$(function () {
$(".btn-open-help").click(function () {
if (window.HubSpotConversations) {
window.HubSpotConversations.clear();
window.HubSpotConversations.widget.refresh();
window.HubSpotConversations.widget.load({ widgetOpen: false });
}
});
});

 

 

Is it normal for same user to sign in again and the conversation history remains even after using these commands? ( note: this has happened too) .

 

These features do not work correctly, sometimes it works sometimes dont work, could you tell me an alternative in pure javascript to force the call of these events or something similar?

 

 

How can I solve this problems?

 

0 Upvotes
WendyGoh
HubSpot Employee
HubSpot Employee

How to identify contact in chat widget using a single-page application?

SOLVE

Hey @matheusmurta, digging into this documentation:

"Note: widget.refresh will not remove existing conversations that a page visitor has started in the widget."

 

and based on my testing, this is working as expected. The historical conversations will remain if we didn't do a page refresh.

 

In order to clear out existing conversations, you will need to call a page refresh e.g. document.location.reload(true). Can I check if you have called this method? If not, can you try this out and see if it works for you?

0 Upvotes
matheusmurta
Solution
Participant

How to identify contact in chat widget using a single-page application?

SOLVE
document.cookie = 'hubspotutk=;Path=/;Domain=.MyDomain.com.br;expires=Thu, 01 Jan 1970 00:00:01 GMT;';

only this way I was able to remove data from old users, I appreciate the attention.

0 Upvotes