Maximise widget based on URL

Hi.
We need the chat widget to be maximised based on a URL. We only want it full size on one specific page. As a second option, can we specify the maximised status for a specific defined group?
I’ve referred to the JS API documentation and can’t see any reference to page URL as a prompt or for a defined group (other than for the “current group” which we don’t want to use as that would mean the widget would be full sized on every page as we will have other groups available on those pages).
Thanks.

Hi!

There are a few solutions I can suggest:

  1. If you have the option to - easiest way to have the chat window automatically open on a single page would be to implement a script on that one page,
    ideally by putting the maximize method:
    Chat Widget JS API | LiveChat Platform Docs & API Reference
    inside of the onReady callback:
    Chat Widget JS API | LiveChat Platform Docs & API Reference
    so that the method is executed as soon as chat window is operational on the website

  2. If you don’t have the possibility to add above JS to just a single page, you could use window.location.href (I’m attaching a documentation of that below):
    JavaScript Window Location
    to get the information about the url of page visitor is currently browsing and then implement a script along the lines of:

If (window.location.href === 'the url you want the chat to open on') {
LiveChatWidget.call("maximize");
}

That should execute the “maximize” method only if current URL reflects the one you provide within a string

  1. LiveChat greetings can open the chat window automatically but there are 3 conditions:
  • Minimized chat window style needs to be set to “bar”
  • Agents must be available to chat (at least 1 agent needs to be on “accepting chats” status)
  • There must be no queue on the license (chat routing needs to be set to “automatic assignment” and the available agent can’t be at maximum of concurrent chats that’s set for them in their profile settings).
    Greetings are conditional by design and you can set up the greeting for a specific page so given all of the above is true - your use case could be achieved without any custom scripts.
    For the reference - more about greetings:
    Engage visitors using targeted messages | LiveChat Help Center

I hope that helps! :slight_smile:

1 Like

Thanks @j.masternak. I’ll give it a go.

2 Likes