# Chat code

Change modify parts of chat box and its behavior.

⛔  Legacy API

You are browsing legacy API. Current version you can find here.


Read this tutorial first: Smartsupp Chat Code (opens new window)

# Configuration

You can modify your own chat code. Enter your configuration after the line with _smartsupp.key All examples are explained below with screenshots and code samples.


<script type="text/javascript">
  var _smartsupp = _smartsupp || {};
  _smartsupp.key = "YOUR_SMARTSUPP_CODE";
  // ...
  // your configuration
  // ...
  window.smartsupp||(function(d) {
    var s,c,o=smartsupp=function(){ o._.push(arguments)};o._=[];

# Sub-domains integration

Smartsupp visitor is identified by unique key stored in cookies. By default chat conversation is terminated when visitor opens a sub-domain on your website. You should set main domain as cookie domain if you want chat conversations uninterrupted across your sub-domains. Insert the cookieDomain parameter in your chat code on main domain and all subdomains where you want the chat conversation uninterrupted.

_smartsupp.cookieDomain = ".your-domain.com";

# Hide chat box on certain pages

You can hide chat box on certain pages by setting the variable hideWidget or hideMobileWidget in your code.

_smartsupp.hideWidget = true; // use on specific pages
_smartsupp.hideMobileWidget = true; // hide chat box on mobile devices

# Privacy notice

You can manually enable or disable privacy notice in chat box. Also you can specify custom url for your own privacy page. This could be useful when you are using Smartsupp chat across several sites.

_smartsupp.privacyNoticeEnabled = false; // privacy notice visibility in chat widget
_smartsupp.privacyNoticeUrl = "https://"; // URL of your privacy page

# Chat box position

By default chat box is displayed in the screen bottom right corner. You can change its position to the left side.

_smartsupp.orientation = "left";

You can offset chat box from default position using offsetX. Distance 100 is in pixels.

_smartsupp.offsetX = 100;

Using offsetY moves the chat box along the Y axis.

_smartsupp.offsetY = 100;

# Custom settings

Use any of these API settings if you want to disable text area and send button, auto messages, sounds for visitors or hide chat bubble.

_smartsupp.writable = false; // text area and send button
_smartsupp.triggerable = false; // auto-messages
_smartsupp.soundMuted = true; // sounds for visitors
_smartsupp.hideBanner = true; // chat bubble

# Mobile chat box

This API code allows you to set when to show mobile chat box.

_smartsupp.smallDeviceMinWidth = 641; // screen width in pixels when mobile chat box is shown

# Chat box position

You can also display chat box along Y axis (on the side of your monitor).

_smartsupp.alignY = "side";