SPA and live chat ignoring trackingView path

SOLVE
tomasz
Member

Hi,

We have problem with single page application and selecting chatflow with depends on query parameter. We are not able to fire the proper chatflow.

 

var _hsq = window._hsq = window._hsq || [];
 
_hsq.push(['setPath', '/myploys?lang=en']);
_hsq.push(['trackPageView']);
 
Chat is completly ignoring query paramaters send with _hsq.push(
window.HubSpotConversations.widget.load();
 
It is still loading bad chatflow.
0 Upvotes
1 Accepted solution

Accepted Solutions
IsaacTakushi
Solution
HubSpot Employee

Hi, @tomasz.

 

Thanks for clarifying.

 

HubSpot live chat widgets use window.location, so they will not change unless the parameters are in the URL. It is not enough to pass the variables to setPath and then trigger widget.refresh().

Isaac Takushi

Alumnus, HubSpot Developer Support

View solution in original post

0 Upvotes
3 Replies 3
IsaacTakushi
HubSpot Employee

Welcome, @tomasz.

 

From your description, it sounds like you're using widget.load() when you should use widget.refresh()widget.load() allows you re-render different chatflows on different page routes.

 

Also, neither window.HubSpotConversations.widget.load() nor window.HubSpotConversations.widget.refresh(); should be included within the _hsq.push() method, which is used for the Tracking Code API. and not the Conversations Live Chat Widget API.

Isaac Takushi

Alumnus, HubSpot Developer Support
0 Upvotes
tomasz
Member

@IsaacTakushi I want to pass variable which are not visible in the url.

What you wrote about _hsq.push is not true.

_hsq.push() works perfectly with live chat because tracking and live chat share the context. 

Example, code below sets contact data.

 

_hsq.push(["identify",{
email: user.email,
firstName: user.first_name,
lastName: user.last_name,
phone: user.phone
}]);
_hsq.push(['trackPageView']);
 
0 Upvotes
IsaacTakushi
Solution
HubSpot Employee

Hi, @tomasz.

 

Thanks for clarifying.

 

HubSpot live chat widgets use window.location, so they will not change unless the parameters are in the URL. It is not enough to pass the variables to setPath and then trigger widget.refresh().

Isaac Takushi

Alumnus, HubSpot Developer Support

View solution in original post

0 Upvotes