Category

Enhancing the Live Chat Widget with Custom CSS and JavaScript

Updated:

The Advanced Customization feature allows you to tailor the appearance and behavior of your live chat widget to better the user experience. Using Custom CSS and Custom JS, you can apply detailed styling and functional enhancements beyond the default settings.

To access and manage Advanced Customization:

  1. Go to Admin > Chat > Live Chat.

    Live Chat.png

  2. Select an existing widget to edit or click Add Widget to create a new one.

    Add Widget.png

  3. Navigate to the Advanced Customization section in the Appearance tab.

    Navigate Advanced Customization.png

How to Add Custom CSS

Custom CSS allows you to modify the visual appearance of the Live Chat Widget. Follow the steps below to add or edit custom CSS styles:

  1. Click the Add Custom CSS to open the custom CSS editor.

    Add Custom CSS.png

  2. Enter your CSS code and click Add to apply it.

    Add Custom CSS.png

  3. Use the edit or delete icons to update or remove existing styles.

    Edit of Delete Custom CSS.png

How to Add Custom JS

Custom JS allows you to control the behavior and functionality of your live chat widget. Follow the steps below to add or edit custom JS:

  1. Click the Add Custom JS to open the custom JS editor.

    Add Custom JS.png

  2. Enter your JS code and click Add to apply it.

    Custom JS.png

  3. Use the edit or delete icons to update or remove existing scripts.

    Edit Custom JS.png

Customizing Widget Header with Custom CSS

This example shows how to use custom CSS to change the colour of the live chat widget’s title and header description. Likewise, you can customise other parts of the widget with your own styles.

.title-container { .title, .title-desc { colour: #800080 !important; } } 

Sample Custom CSS.png

Customizing Widget Menu with Custom JS

This example demonstrates how to use custom JS to add a close button inside the menu popup that triggers the chat widget’s close functionality. Similarly, you can use custom JS to implement other custom features in the widget.

window.$boldChat = window.$boldChat || [];

// Add "Close Widget" option to the menu
window.$boldChat.push(["do:addOption", "Close Widget"]);

// Add event listener for menu option clicks
window.$boldChat.push(["on:moreOptionClick", onMoreOptionClick]);

// Function to handle menu option clicks
function onMoreOptionClick(item) {
 if (item.name === "Close Widget") {
   // Close the chat widget
   window.$boldChat.push(["do:setIsOpen", false]);
 }
} 

Sample Custom JS.png

  • Any custom code you add to the widget is your responsibility. Please take care when making these modifications because they could impact your customer experience.
  • When incorporating CSS or JS, please use proper syntax.

How to hide live chat system notifications using Custom CSS

Some customers may want to hide system-generated messages in the Live Chat widget, such as the notification shown when an agent joins a conversation. This can be done using Custom CSS in the widget Advanced Customization area.

Use case

Hide the join and other system notification messages that appear in the customer chat thread, for example the agent joined conversation message.

How to apply the CSS

Go to AdminChatLive Chat → edit the widget → AppearanceAdvanced CustomizationCustom CSS and add the required CSS rule.

Option 1. Hide all widget notification messages

Use this rule when you want to hide every notification message in the widget.

.notification-msg { 
  display: none; 
}

Impact
This hides all notification messages, including agent assignment and conversation state updates such as open and reopen.

Option 2. Hide assignee notification independently

Use this rule to hide only the assignee notification.

.assignee-notification {
  display: none;
}

Option 3. Customize status notification independently

Use this rule to style or control the status notification separately.

.status-notification {
  background: green !important;
}

Frequently Asked Questions

  1. Can I revert back to default widget settings?
    Yes. You can remove or disable your custom CSS/JS entries using the delete icon.

  2. Will incorrect code break the widget?
    Possibly. Invalid CSS may cause styling issues; invalid JS may prevent the widget from loading properly. Always test changes in a safe environment first.

  3. Can I combine multiple CSS or JS rules?
    Yes. You can add multiple entries, or consolidate all rules into a single entry for better organisation.

  4. Do CSS or JS updates take effect immediately?
    Changes usually apply immediately after saving and refreshing the page.

  5. Does BoldDesk provide an API for advanced JS customization?
    Yes. The BoldDesk Live Chat Web SDK supports extended widget control and event handling.

Related Articles

  1. How to Customize the Live Chat Widget to Reflect Your Brand
  2. BoldDesk Live Chat Web SDK: Integrate & Control Chat Widget
Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied
Access denied
Access denied

No articles or sections found
No articles or sections found