A mock customer product landing page that integrates the AikeChat support widget with one <script> tag.
A support icon appears in the lower-right corner; open it to chat with echo-bot.
Use one <script> tag without writing any JS:
<script src="http://localhost:18080/sdk/leke-chat.umd.js" data-site-key="demo-site-key" async></script>
For more optional fields (username / phone / email / widget title / display language / skill group, etc.), see
Initialization parameters below and use the matching data-* column.
Use this when you need to pass complex structures such as user.extra:
<script>
window.AiKeChatConfig = {
siteKey: 'demo-site-key',
user: {
externalUserId: 'biz-uid-12345',
extra: { vipLevel: 'gold' }
}
};
</script>
<script src="http://localhost:18080/sdk/leke-chat.umd.js"></script>
Define the config before the SDK script. data-* and AiKeChatConfig can be used together; data-* overrides fields with the same name.
Use this for dynamic configuration or on-demand mounting in an SPA:
<script src="http://localhost:18080/sdk/leke-chat.umd.js" data-auto-init="false"></script>
<script>
AiKeChat.init({
siteKey: 'demo-site-key',
user: { externalUserId: 'biz-uid-12345', username: 'John Doe' },
title: 'Customer Support'
});
</script>
When the SDK starts, it calls /v1/visitor/auth to exchange the siteKey for a JWT,
and all subsequent WebSocket connections include that JWT. user.deviceFp automatically falls back to localStorage, so returning visitors can be merged.
/v1/visitor/auth {siteKey, user}?token=<JWT>The following fields support all three input methods: data-* attributes (recommended) / window.AiKeChatConfig / AiKeChat.init().
| JS field | data-* attribute | Required | Description |
|---|---|---|---|
siteKey | data-site-key | Yes | Customer SDK key |
user.externalUserId | data-external-user-id | No | User ID in your system; recommended when merging users across devices |
user.username | data-username | No | User name |
user.phone | data-phone | No | Phone number |
user.email | data-email | No | Email address |
user.extra | โ | No | Custom key-value pairs; only supported by AiKeChatConfig / init() |
title | data-title | No | Widget title |
locale | data-locale | No | zh-CN / zh-TW / en / id / ms |
skillGroupId | data-skill-group-id | No | Specified skill group; leave empty to use the customer's default |
| Control | data-auto-init="false" | No | Disables auto init; use this when calling AiKeChat.init() yourself |
leke-chat.umd.js: ~14 KB (gzip ~5 KB)leke-chat.mjs: ~18 KB (gzip ~6 KB)leke-chat.d.ts: TypeScript types
โ The lower-right corner shows the real support widget loaded from /sdk/leke-chat.umd.js