Breaking customer's session between groups
Introduction
By default, a visitor can keep browsing the website, navigate through different subpages and the conversation will follow. This applies by default, no matter if the very same group is loaded across entire website, or different groups are loaded. If changing group should come with ending conversation with the previous one, there is an extra parameter to achieve that. Preventing chat continuity when moving between pages with different groups can be useful especially when the same LiveChat account loads on a few different websites that visitors can move between.
Usage
By default the parameter isn't added to LiveChat snippet. It is equivalent to having the feature disabled, and its value set to false.
window.__lc.chat_between_groups = false;
In order to enable the feature, it needs to be added to LiveChat snippet with the value set to true.
window.__lc.chat_between_groups = true;
Complete LiveChat snippet with enabled feature of breaking session between groups would look like below (<LICENSE_NUMBER>
should be replaced with actual license number)
<!-- Start of LiveChat (www.livechat.com) code -->
<script>
window.__lc = window.__lc || {};
window.__lc.license = <LICENSE_NUMBER>;
window.__lc.chat_between_groups = true;
;(function(n,t,c){function i(n){return e._h?e._h.apply(null,n):e._q.push(n)}var e={_q:[],_h:null,_v:"2.0",on:function(){i(["on",c.call(arguments)])},once:function(){i(["once",c.call(arguments)])},off:function(){i(["off",c.call(arguments)])},get:function(){if(!e._h)throw new Error("[LiveChatWidget] You can't use getters before load.");return i(["get",c.call(arguments)])},call:function(){i(["call",c.call(arguments)])},init:function(){var n=t.createElement("script");n.async=!0,n.type="text/javascript",n.src="https://cdn.livechatinc.com/tracking.js",t.head.appendChild(n)}};!n.__lc.asyncInit&&e.init(),n.LiveChatWidget=n.LiveChatWidget||e}(window,document,[].slice))
</script>
<noscript
><a href="https://www.livechat.com/chat-with/<LICENSE_NUMBER>/" rel="nofollow"
>Chat with us</a
>, powered by
<a
href="https://www.livechat.com/?welcome"
rel="noopener nofollow"
target="_blank"
>LiveChat</a
></noscript
>
<!-- End of LiveChat code -->
Standard LiveChat tracking code can be always found at Settings - Channels - Install LiveChat (link)
To control loading specific group depending on URL/domain or visitor's location we recommend using Routing Rules at Automate section (link)
Live example
Demo to allow/disallow chatting between groups is available at: https://pnlrhx.csb.app
If you have any questions, let us know!
Yours, Text Team 💛