Embed code and widget options
Everything the Botello script tag does, its attributes, allowed domains and what it stores in the visitor’s browser.
- Plans
- All plans
- Roles
- Owner, Admin, User
- Channels
- Website
- In the admin
- Chatbot › Configuration › Install
The Botello widget is a single <script> tag. It loads widget.js from Botello, reads your assistant’s configuration, then renders the bubble and the chat panel in an isolated frame (iframe). This page describes exactly what the script does, its attributes, and how it works with allowed domains. For step-by-step installation, see Install the chatbot on your website.
Developers embedding Botello in a custom site, a single-page application (React, Vue, Next.js) or a headless Shopify theme, or who need to document the script for a security or cookie audit.
Before you start
- You have copied the code from Chatbot, Install tab (Copy code).
- The Website URL and, if needed, the Allowed domains are filled in under the Security section of the same tab.
The tag
<script src="https://admin.botello.ch/widget.js" data-project-id="YOUR-CHATBOT-ID"></script>Place it before </body>, on every page where the assistant should appear. The script can also be loaded with defer or async: if it cannot identify itself as the current script, it finds its own tag by its src (widget.js) and its data-project-id attribute.
Attributes
Prop
Type
Use "auto" mode only with rate-based prices
Only enable data-currency-mode="auto" if your foreign prices are calculated from exchange rates in Shopify. If you set prices manually per market, rate-based conversion would show amounts that differ from those in the cart.
The script also recognizes data-mock-… attributes reserved for debugging by the Botello team. Do not use them in production.
What the script does, in order
- It reads
data-project-idand immediately defineswindow.Botello.identify(see JavaScript API). - It reads
window.BotelloSettings.identityTokenif present. - It fetches the assistant’s status and appearance from Botello. If the assistant is disabled, it stops without rendering anything.
- It creates the bubble and the panel, then loads the chat in an iframe served by
admin.botello.ch. The panel starts closed. - It sends the current page (path and title) to the iframe via
postMessageon every navigation, including in a single-page application (pushState,replaceState,popstate). This way the assistant knows which page the visitor is on. - It forwards the visitor’s identity token if there is one, only to the iframe’s origin, never in a URL.
The widget picks its interface language in this order: the browser language, then the lang attribute of your <html> tag, then French.
Allowed domains
The widget is meant to run on your site. Allowed pages are:
- the host of the Website URL;
- the hosts listed in Allowed domains;
- for each one, the version with or without
www.and all its subdomains:example.challowsshop.example.ch, but notfake-example.ch.
Botello has two checks on the page displaying the widget:
- server side, based on the page’s origin: a page not on the list gets a
403error with the codeWIDGET_DOMAIN_NOT_ALLOWED; - browser side, through the
frame-ancestorsrule, which defines which pages may display the chat iframe. Botello’s own pages (admin.botello.ch,botello.ch,app.botello.ch) are always allowed.
Each check can run in report mode (the unlisted page is only logged and the widget is shown) or in block mode. Both are in report mode by default. A chatbot with neither a Website URL nor Allowed domains is never rejected by the server-side check. Fill in your domains at installation anyway, so you are ready if blocking is turned on.
Testing on a staging domain
Add your test domain (for example staging.example.ch or example-staging.netlify.app) to Allowed domains. A subdomain of your main site is already covered.
What the script stores in the browser
Useful for your cookie banner and your record of processing activities. All keys are on your domain, suffixed with the chatbot ID. The script sets no cookies.
| Storage | Key | Content | Lifetime |
|---|---|---|---|
localStorage | botello_session_<id> | ID of the current conversation, to resume it from page to page | Until a new conversation |
localStorage | botello_visitor_<id> | Anonymous, random visitor ID, to count unique visitors | Permanent |
localStorage | botello_leadgate_<id> | 1 if the visitor has already filled in the pre-chat form | Permanent |
sessionStorage | botello-panel-size-<id> | Panel size chosen by the visitor (desktop) | Tab |
sessionStorage | botello-invite-dismissed-<id> | 1 if the visitor closed the invitation next to the bubble | Tab |
If the browser blocks storage (strict private browsing, the Instagram or Facebook in-app browser), the widget still works: the visitor simply starts a fresh conversation.
The chat itself, inside the iframe served by admin.botello.ch, also keeps a few values in that origin’s localStorage (so third-party storage, from your site’s point of view): the conversation ID and visitor ID (botello_session_<id>, botello_visitor_<id>), the botello_leadgate_<id> flag, the state of submitted contact requests and their draft (botello_handoff_done_…, botello_handoff_draft_…), the contact cards shown (botello_contact_cards_…), the translated interface strings (botello_widget_strings_<language>) and the day’s exchange rates (botello-fx-rates-gbp). One sessionStorage key (botello_welcome_animated_…) prevents the welcome animation from replaying. The iframe sets no cookies. If the browser blocks third-party storage, these values are kept in memory for the lifetime of the page.
Examples
Troubleshooting
| What you see | Likely cause | Fix |
|---|---|---|
| Console: “Botello Widget: Chatbot ID missing or invalid.” | data-project-id missing or empty | Copy the code again from ChatbotConfigurationInstall |
| Console: “Botello Widget: Chatbot is inactive.” | The assistant is disabled | Re-enable it, or contact the Botello team |
| The bubble does not appear on a test domain | The domain is not allowed | Add it to Allowed domains |
| Two bubbles appear | The script is included twice (theme and plugin) | Keep a single tag |
| Prices are in the wrong currency (Shopify) | No market price for that currency | Create market prices in Shopify, or use data-currency-mode="auto" if your prices are rate-based |
| The assistant does not know which page the visitor is on | Navigation through a router that does not use the History API | Report it to support@botello.ch |