We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Feb 3, 2019 7:40 PM
Hi there,
I am currently working on integrating Hubspot LiveChat into a SPA React web application. At the moment we are experiencing issues with identifying multiple users across multiple sessions.
The issue I have, is that once I include the Hubspot JS, it records the first captured e-mail address as the identity of the end user, with no way of updating.
There are two scenarios that I have come across:
Tracking of non-hubspot forms enabled
1. Enable track non-hubspot forms
2. Include Hubspot js on our index.html
3. Visit the website (which redirects the user to a login form)
4. Attempt to sign in as admin@domain.io with an invalid password
5. Attempt to sign in as user@domain.io with a valid password
6. Open Hubspot chat - within Hubspot, the support agent would see my identity as admin@domain.io, even though I was signed in as user@domain.io.
Tracking of non-hubspot forms disabled
1. Include Hubspot js on our index.html
2. Visit the website (which redirects the user to a login form)
3. Attempt to sign in as user1@domain.io with a valid password
4. On successful sign in, we identify the visitor using:
__hsq.push(["identify", { email: 'user1@domain.io' }])
Hubspot docs - Identify a visitor
5. Sign out
6. Sign in as user2@domain.io with a valid password
7. Repeat step 4 with email as user2@domain.io
8. Open Hubspot Chat - the support agent sees my identity as user1@domain.io
The only way I have found to get around these issues, is to clear the Hubspot cookies / local storage on every logout.
If anyone has any tips or guidance for a better approach to these issues, please post a reply
Thanks
Michael
Solved! Go to Solution.
Mar 15, 2019 9:04 AM
I forgot to update this post, apologies.
The revokeCookieConsent
method now removes the messagesUtk
cookie, allowing you to clear live chat identities on the same device. This change has been live since February 21, 2019.
Isaac TakushiAssociate Certification Manager |
Feb 5, 2019 11:41 AM
Welcome, @memcc.
Apologies for the delayed response.
I can confirm that the identify
function cannot overwrite an existing contact's email address. Here's a similar post I responded to a few months ago. If you do need to overwrite a visitor's email with a new value upon login, you could use this Forms API endpoint.
That said, while I was investigating your queries, I found an issue where the messagesUtk
cookie (which is separate from the regular hubspotutk
cookie) does not get cleared when you call revokeCookieConsent
. This can cause issues because when a new hubspotutk
cookie is issued (e.g. to a user who logged in with a different email on the same browser), it will copy the value of the messagesUtk
cookie of the previous visitor. I'm sharing this discovery with my team and hopefully we'll implement a more robust solution in the near future.
Isaac TakushiAssociate Certification Manager |
Feb 5, 2019 4:21 PM - edited Feb 5, 2019 4:27 PM
Hi @IsaacTakushi,
No worries - thanks for getting back to me.
This makes sense now, as previously calling removeCookieConsent was still holding on to message state.
With regards to identifying our logged in users, would you recommend using the Forms API endpoint instead of the following steps: Hubspot - Identify a visitor docs?
Thanks again,
Michael
Feb 7, 2019 10:44 AM
Hi, @memcc.
I just wanted to let you know that the team is going to add the messagesUtk
cookie to the revokeCookieConsent
method! Once implemented, the live chat modal should not display previous conversations when users log out and you call revokeCookieConsent
. I'll update here when that change has been pushed to production.
Once this change takes place, I don't see a ton of difference between using the identify
method and the Forms API. Since you've already built around the identify
method, I might just stick with that. The only thing this function can't do (as I mentioned) is overwrite a user's email
address. For that, you would need to use the Forms API.
Isaac TakushiAssociate Certification Manager |
Mar 15, 2019 9:04 AM
I forgot to update this post, apologies.
The revokeCookieConsent
method now removes the messagesUtk
cookie, allowing you to clear live chat identities on the same device. This change has been live since February 21, 2019.
Isaac TakushiAssociate Certification Manager |