Chat Widget

This guide explains how to add the Jim’s Chat widget to your website and how to change its behaviour and colours.

No coding experience is required; you only need to paste a few snippets and edit some values.


How to embed the widget

Add the widget to your webpage in two steps:

  1. Include the widget script
    Put this before the closing </body> tag. The widget is hosted on our CDN—use this URL exactly:
<script type="module" src="https://cdn.jims.net/chatwidget/chatwidget.js"></script>
  1. Place the widget on the page
    Where you want the chat button to appear, add this tag:
<jims-chat></jims-chat>

Example:

<jims-chat></jims-chat>
<script type="module" src="https://cdn.jims.net/chatwidget/chatwidget.js"></script>

Save the page and open it in a browser. The chat button should appear (usually in the bottom-right corner) when the chat is available.


Widget settings

You can change how the button looks and where it sits by passing settings as a JSON object in the settings attribute.

Basic example with settings

<jims-chat settings='{"button":{"text":"Chat with us","position":{"horizontal":"right","vertical":"bottom"},"orientation":"horizontal"}}'></jims-chat>

What each setting does

Button

SettingWhat it controlsAllowed values
button.textThe label on the chat buttonAny text, e.g. "Live Chat", "Help", "Chat with us"
button.position.horizontalHorizontal position of the button"left", "middle", "right"
button.position.verticalVertical position of the button"top", "middle", "bottom"
button.orientationDirection of the button text"horizontal" (normal text), "vertical" (text top to bottom), "vertical-bt" (text bottom to top). Vertical orientations are only used when the button is on the left or right (any vertical position); otherwise the widget falls back to horizontal.

Info panel (pre-chat form)

SettingWhat it controls
info.headerTitleHeading shown at the top of the panel, e.g. "Want to chat with a real person?"
info.closeLabelAccessible label for the close button, e.g. "Close"
info.bodyTextShort description above the form, e.g. "Fill in the details below and we'll get you connected to a real person."
info.submitLabelLabel for the submit button, e.g. "Get chatting"

Example: button on the left, at the top

<jims-chat settings='{"button":{"text":"Need help?","position":{"horizontal":"left","vertical":"top"},"orientation":"horizontal"}}'></jims-chat>

Example: vertical button on the right

Vertical text is only applied when the button is on the left or right (any vertical position):

<jims-chat settings='{"button":{"text":"Chat","position":{"horizontal":"right","vertical":"bottom"},"orientation":"vertical"}}'></jims-chat>

Example: custom info panel text

<jims-chat settings='{"button":{"text":"Chat","position":{"horizontal":"right","vertical":"bottom"},"orientation":"horizontal"},"info":{"headerTitle":"Talk to us","bodyText":"Share your details and we'll connect you.","submitLabel":"Start chat"}}'></jims-chat>

Tip: Keep the settings value in single quotes '...' and put the JSON in double quotes "..." inside, as in the examples. If you need a quote in your button text, use \" (backslash then double quote) inside the JSON.


Changing colours with CSS variables

The widget exposes CSS variables (custom properties) so you can match its colours to your site. Add a <style> block in your page (for example in the <head>), or put these rules in your site’s main CSS file.

You can override these --jims-chat- variables on the jims-chat element:

VariableWhat it affectsExample value
–jims-chat-colorButton background, info panel header, accents#0255a5 (blue) or any hex colour
–jims-chat-color-foregroundText and icons on top of the accent colour#ffffff (white) or any colour

Example: blue button and white text (default style):

jims-chat {
  --jims-chat-color: #0255a5;
  --jims-chat-color-foreground: #ffffff;
}

Example: green button with white text:

jims-chat {
  --jims-chat-color: #2d7a3e;
  --jims-chat-color-foreground: #ffffff;
}

Target the jims-chat element (the custom tag you added to the page). If your CSS is global, you can use jims-chat { ... } as in the examples above.


Full example page

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>My website</title>
  <style>
    jims-chat {
      --jims-chat-color: #0255a5;
      --jims-chat-color-foreground: #ffffff;
    }
  </style>
</head>
<body>

  <h1>Welcome to my site</h1>
  <p>Use the chat button if you need help.</p>

  <jims-chat settings='{"button":{"text":"Chat with us","position":{"horizontal":"right","vertical":"bottom"},"orientation":"horizontal"}}'></jims-chat>
  <script type="module" src="https://cdn.jims.net/chatwidget/chatwidget.js"></script>

</body>
</html>

Adjust the settings and the CSS variables to match your brand and layout.