I implemented Hubspot on a Vue-SPA.
It works as expected. But the chat-widget isn't tracking the SPA page transitions.
The docs suggest to use window.HubSpotConversations.widget.refresh();
to handle untracked page transitions on SPAs.
If the the set delay for showing the welcome text is not over yet.
The refresh()
will trigger the wrong chat-flow.
But if it's already over, this works.
Kind of.
Because if the new welcome text is longer than the old one, it gets cropped.
The old welcome text
The new one but cropped
The new one displayed correctly
Another Problem:
An already started conversation via chat wont be ended by refresh()
but if the chat was open it will be closed after. And I can't figure out how to tell the widget to reopen as you would expect.
As described here: https://developers.hubspot.com/docs/api/events/tracking-code, you need to handle route change events in your SPA and then call
trackPageView
like this:you may also want to call
setPath
in some scenarios as described in the doc.