Dynamic group parameter

My problem: I need to change window.__lc.group dynamically in some moments.

My actions:

  1. Set window.__lc.group = 1
  2. Add script to HEAD
  3. Call LC_API.diagnose(). Group = 1 it’s correct.
  4. Delete script ( scriptElement.remove() )
  5. Change window.__lc.group = 2
  6. Add script to HEAD again
  7. Call LC_API.diagnose(). Group still = 1 it’s NOT correct.

So my question how can I change it dynamically?

Hi!

Unfortunately, it’s not possible to set the group ID dynamically. The group is set once the widget is loaded and changing the group requires reloading the entire chat widget. What our tech support recommends, given it works with your implementation, is to use the group-selection element in the pre-chat survey, as that’s the only option to change the group without reloading the chat widget.

Tell me if that helps!

Thanks for your answer! Then I have a second question: can I reload the entire chat widget without reload all site page?

Hi!

Could you let me know more about your use case?
I’m thinking - if purpose of dynamically changing groups is routing to agents specifically,
perhaps a back-end solution would be easier to implement.
For example a bot that receives all chats first and then transfers each chat accordingly to different groups based on data of your choice?

Kind regards :slight_smile: