Using this setting, you can fine-tune your website for performance, while still leveraging all features on specific pages.
This article includes the following topics:
- Understanding the Web Widget-Chat connection
- Understanding the connectOnPageLoad setting's impact
- Adding connectOnPageLoad to your web pages
Understanding the Chat-Web Widget (Classic) connection
By default, Web Widget (Classic) connects to live chat services on page load, for any page where the widget snippet is embedded AND Chat is enabled.
The timing of this connection makes features like proactive chat and conversion tracking possible. However, it can negatively affect performance in a number of ways:
- If you have high visitor traffic volume, these connections can reduce the performance of your chat product, and make it more difficult to identify customers when monitoring your website visitors.
- It impacts Web Widget (Classic) performance. Connecting to live chat on page load means that more assets need to be delivered, before the Web Widget (Classic) is interactive on a web page. This can impact your overall web page load speed.
Understanding the connectOnPageLoad setting's impact
When you enable the
connectOnPageLoad setting, there should be no noticeable impact on the end user experience. There may be a slight delay of one to two seconds (at the most) when a customer opens the widget.
connectOnPageLoad to defer the connection comes with some important trade-offs to consider, before implementation.
connectOnPageLoad = true:
- There is no impact on live chat functionality. The live chat experience is the same as if there is no
connectOnPageLoadsetting in the page code.
connectOnPageLoad = false:
- You will only be able to monitor visitors who have initiated chat or have clicked on the Web Widget (Classic).
- Some of the live chat features may be impacted, such as conversion tracking, proactive triggers, and Web Widget (Classic) JS APIs which rely on visitors' connections with Chat services.
To learn more about the impact of using
connectOnPageLoad in different configuration scenarios, see ConnectOnPageLoad: Configuration best practices for common Chat use cases.
Adding connectOnPageLoad to your web pages
connectOnPageLoadto any page with the embedded Web Widget (Classic). The setting is added to the source code on each web page, as in the following example:
The setting must be assigned a value, either true or false, which determines how visitors are handled on each page:
connectOnPageLoad: true: Connects to the Chat service when the page loads, allowing you to engage with every visitor on that web page.
connectOnPageLoad: false:Connects to the Chat service when a user interacts with the widget, allowing you to focus on visitors currently chatting with agents, or who have initiated a chat.
connectOnPageLoad, see ConnectOnPageLoad: Configuration best practices for common Chat use cases.
To include the
connectOnPageLoad setting on your website
- In the source code of the web page, locate the Chat widget code snippet.
- Add the
connectOnPageLoadsetting to your source code, above the Web Widget (Classic) code snippet:
- Set the value of
falsedepending on your use case.
- Save and publish the page.
- Repeat these steps on every page of your website with the widget embedded.
If I use Web Widget only for "Contact forms" and NOT for "Chat", can I still enable the:
in order to improve performance site?
Thank you for reaching out to Zendesk Support.
In regards to your concern, the following performance benefits of using this code are mainly used in the Chat dashboard. This will help where agents are handling a large number of incoming chat requests and those who are interacting with the Web Widget.
I don't see any issues using the following code since you will not be using chat or engaging with end-users from the web widget.
Please don't hesitate to reach out if you have any other questions or concerns. Thank you and have a wonderful day ahead!
DJ Buenavista Jr. |
Customer Advocacy Specialist | Support@Zendesk.com
We've implemented the suggestion but it loads intermittently or hangs with loading animation. Any idea what is wrong? This is our script:
Thanks for your message. Apologies for the short delay in my reply.
The script looks OK, as is. Would you mind sending over your website URL so we can see this in action and investigate further?
Ive also implemented the suggestion with the following script, but the chat button does not display at all when connectOnPageLoad is set to false. It only displays when set it to true.
Id like to have the chat button displaying, but only actually connecting once user clicks the chat button.
Thanks for your message.
Would you mind sending over your website URL so we can see this in action and investigate further?
Thanks for replying,
Is there an email I can send to you?
Sure. I just contacted you via email. Please respond there and we can continue the conversation.
were you guys able to get this issue resolved? i am having the same issues where the Classic Widget is slowing down my Wix website. I have a post up but haven't heard back from anyone relating this issue
Please sign in to leave a comment.