Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
What is the correct way to implement the Chat?
Participant
Mar 11, 2020 5:25 AM
Hi folks,
i've read here and tested and changed my code several time, but setting the identity works not 100% of our cases.
The code is
after login
static setChatIdentity = (email) => { if (window.HubSpotConversations) { this.onConversationsAPIReady(email); } else { window.hsConversationsOnReady = [this.onConversationsAPIReady(email)]; } } static onConversationsAPIReady = (email) => { console.log("onConversationsAPIReady", email); setTimeout(() => { var _hsq = window._hsq = window._hsq || []; //_hsq.push(["doNotTrack"]); //_hsq.push(['doNotTrack', {track: true}]); //_hsq.push(["setPath", "/chat"]); //window.HubSpotConversations.clear(); //_hsq.push(["revokeCookieConsent"]); _hsq.push(["identify", { email: email }]); _hsq.push(["trackPageView"]); //window.HubSpotConversations.widget.refresh(); //window.HubSpotConversations.on("conversationStarted", payload => { //_hsq.push(["doNotTrack"]); //}); setTimeout(() => { console.log("refresh", email) _hsq.push(["identify", { email: email }]); _hsq.push(["trackPageView"]); window.HubSpotConversations.widget.refresh(); }, 2000); }, 1000); }
Most of the time, this is working, but that's not enough. And i have no idea, what i must do, to make this more stable.
Has somebody another hint for me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content