Widget loading
The script you copy from Configuration → Script includes a data-kanbu-load attribute. It controls when the chatbot itself is downloaded and started after you embed the script. It does not control whether the chat panel expands on its own — that is Open chat automatically, see Bubbles and prompts.
The default is idle. The script generated in the app uses that value. Keep it for most websites — the chatbot loads after the page finishes, while the browser is idle.
1. How to change the strategy
- Copy the script from Configuration → Script.
- Change the
data-kanbu-loadvalue (see options below). - Paste the edited script into Google Tag Manager or the website code — same steps as in Deploying on the web.
Example with immediate loading:
<script
async
src="https://loader.kanbu.ai/v0/embed.js"
data-kanbu-agent-id="YOUR-AGENT-ID"
data-kanbu-load="immediate"
></script>
Write the value in lowercase. An unknown or missing value behaves as idle.
2. Available values
-
idle(default, recommended)Waits until the page has loaded (
window.load), then downloads the widget during browser idle time. Lowest impact on website speed. The chat icon may appear a moment later than the rest of the page. -
loadDownloads the widget right after
window.load, without waiting for idle time. The chatbot appears sooner than withidle, but still only after the page has finished loading. -
immediateDownloads and starts the widget as soon as
embed.jsruns — it does not wait for the page to finish. The widget is available soonest. It also competes most with other page resources (images, your own scripts), so it can slow the first paint. Use it when chat should be ready right away — a landing page, QR link, kiosk, or when Open chat automatically is on. -
interactionThe widget downloads only after the visitor's first action (click, keypress, touch, or scroll). Until then the chatbot downloads nothing and does not load the page. The first open can take a moment, because the code is fetched then. Use it when site performance comes first and the chatbot is a secondary feature.
3. Impact on the site and on chat
| Value | When the widget downloads | Impact on site speed | When chat is available |
|---|---|---|---|
idle | after page load, during idle time | lowest | a moment later |
load | right after page load | low | after the page has loaded |
immediate | as soon as the script runs | highest | soonest |
interaction | after the visitor's first action | virtually none until then | after interaction, with a short delay |
The strategy only affects download and startup of the widget. Once it is running, the same appearance settings, embed domains, and placement apply.
If Open chat automatically is on, the chat expands only after the widget has loaded. With idle or interaction that is not immediately on page open — for a landing page or QR link use immediate or load.
4. Optional timeout for idle
With idle you can add data-kanbu-idle-timeout — the maximum wait in milliseconds before the widget downloads even if the browser is not yet idle. The default is 5000 (5 seconds).
<script
async
src="https://loader.kanbu.ai/v0/embed.js"
data-kanbu-agent-id="YOUR-AGENT-ID"
data-kanbu-load="idle"
data-kanbu-idle-timeout="5000"
></script>
On browsers without requestIdleCallback, the widget starts almost immediately after the page has loaded.
Frequently asked questions
-
Do I have to include the attribute?
No. Without
data-kanbu-load,idleapplies. The script from the app includes it so the behaviour is explicit. -
Does this change which pages the chatbot appears on?
No. Which pages the script may run on is Embed domains and the Google Tag Manager trigger.
-
The chat does not expand after the page loads. Is that this option?
No. Expanding the chat is the Open chat automatically toggle in Bubbles and prompts.
data-kanbu-loadonly says when the chatbot code is downloaded at all. -
Why does the chatbot appear late on a slow website?
The script from the app uses
idle. The widget waits for the page to finish and for the browser to be free. If the icon (or an open chat) should be there immediately, change the value toloadorimmediate.
Related
- Deploying on the web — how to embed the script
- Embed domains — where the script may run
- Bubbles and prompts — automatic chat open
- Chatbot placement