APIs & Integrations

DeclanMurphy
Participant

Hubspot Livechat Identification issues with messagesUtk [AngularJS / SPA]

SOLVE

We have Hubspot Livechat running on an AngularJS SPA. I have two separate issues that we require some advise on if possible:

Scenario 1

When a user logs out of our app, we call revokeCookieConsent, which clears messagesUtk. However the issue we are experiencing is that when if the person remains on the same browser session and logs in as the same user (or a new user), the messagesUtk remains unset. This means that our Hubspot identifcation doesn't function (even if we execute the code for it). So when that same user sends a message to us via Livechat, they are labelled in the Inbox as an unknown visitor. 

 

When the page is refreshed on the browser, some code is executed that sets messagesUtk with a new value. However since we use an SPA, we want to programatically execute the same function? Is this possible?

 

Scenario 2

revokeCookieConsent appears to correspond to cookie consent banner being reset. However how do we achieve the case where:

  1. A Hubspot identified user who has previously accepted cookies user logs out of my app
  2. We de-identify/unassociate them from their Hubspot chat using revokeCookieConsent
  3. The user does not have to accept hubspot cookies again when they return to our app

 

Source: https://community.hubspot.com/t5/APIs-Integrations/Hubspot-LiveChat-Identifying-users-within-Single-...

0 Upvotes
1 Accepted solution
zaklein
Solution
Contributor | Platinum Partner
Contributor | Platinum Partner

Hubspot Livechat Identification issues with messagesUtk [AngularJS / SPA]

SOLVE

Hi @DeclanMurphy 

I'm guessing you've already read this, but just in case, there's a section in the HubSpot Tracking Code API documentation called "Tracking in single-page applications", which may give you some guidance on how to handle this.

Have you considered changing your use of the revokeCookieConsent function on the user logout action? I've only ever used this to cover cases where people have indicated (via a cookie preference platform) they don't want to be tracked (for example) or before specific browser cookie permissions have been granted. I've not seen it used before to cover the case you have described.

I hope that's helpful. Let me know if you have any follow up questions or if things have moved on since your original post.

All the best,

Zach

View solution in original post

0 Upvotes
2 Replies 2
zaklein
Solution
Contributor | Platinum Partner
Contributor | Platinum Partner

Hubspot Livechat Identification issues with messagesUtk [AngularJS / SPA]

SOLVE

Hi @DeclanMurphy 

I'm guessing you've already read this, but just in case, there's a section in the HubSpot Tracking Code API documentation called "Tracking in single-page applications", which may give you some guidance on how to handle this.

Have you considered changing your use of the revokeCookieConsent function on the user logout action? I've only ever used this to cover cases where people have indicated (via a cookie preference platform) they don't want to be tracked (for example) or before specific browser cookie permissions have been granted. I've not seen it used before to cover the case you have described.

I hope that's helpful. Let me know if you have any follow up questions or if things have moved on since your original post.

All the best,

Zach

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Hubspot Livechat Identification issues with messagesUtk [AngularJS / SPA]

SOLVE

@zaklein , is this in your wheelhouse?

Thanks,

Dennis




HubSpot Community Developer ShowMake sure to subscribe to our YouTube channel
where you can find the HubSpot Community Developer Show
0 Upvotes