Skip to main content

Installation

Embed the TWT Chat widget on every page of your website.

Install

Copy and paste the following snippet before the closing </body> tag on each page:

<!-- Start of TWT Chat code -->
<script>
window.__twt__config = {
appid: 'YOUR_APP_ID',
lang: 'zh-cn',
theme: 'light',
sbs: '',
sbs_mm: '',
ranstr: '',
name: '',
nickname: '',
email: '',
phone: '',
icon: '1'
};
(function (n, t) {
var e = {
init: function () {
var n = t.createElement('script');
n.async = !0;
n.type = 'text/javascript';
n.src = 'https://visitorchat.twt.com/install/core.js?version=v1.2';
t.head.appendChild(n);
}
};
e.init();
})(window, document);
</script>
<!-- End of TWT Chat code -->
tip

You can copy a prefilled version of this snippet with your appid from Settings > Website Code in the TWT Chat console.

Configuration Fields

FieldTypeRequiredDescription
appidstringYesUnique application identifier from the console
langstringNoUI language: zh-cn, zh-tw, or en
themestringNoTheme mode: light or dark
iconstringNoLauncher style. "1" shows the default icon and "2" hides it
sbsstringNoUnique customer identifier
sbs_mmstringNoCustomer signature
ranstrstringNoRandom string, recommended to be 16 characters or longer
namestringNoCustomer full name
nicknamestringNoCustomer alias
emailstringNoCustomer email
phonestringNoCustomer phone number

For details about customer identity fields, see URL Parameters and Customer Information.