#Web widget
Try the agent with Try the agent in the inbox; the MCP's
get_status gives its link as try_it. To put chat in front of
customers on your own website, get_status also returns put_in_the_app:
publishable_key: the workspace'svatpub_key, the one in the widget's install snippet. Vatio keeps it for every workspace, and it is the same key in development and in production.widget: the widget's script tag with that key, ready to go before</body>.note: where the key and the tag go, and that the key works from any site or app,localhostand production alike.
A coding agent needs no key of its own and decides nothing about origins: it
puts widget in the page, the same tag on your own machine and in
production. The inbox's Web chat page shows the same snippet:
<script async src="https://cdn.vatio.ai/v1/widget.js" data-workspace="acme" data-token="vatpub_REPLACE_ME"></script>On your site, a staging domain or in an app, the widget talks to the version
everyone has: it gets a change once the tests that pass today pass on it, a
few minutes later (Deployments). On your own machine, a page
served from localhost, a .local or .test name or a private address, the
same key talks to the newest version, the one your team has: it gets a change
at once, its tools read each secret's test value, and its conversations are
your team's, marked Team in the inbox's Conversations. Try the agent and
the MCP's chat_with_agent talk to the newest version too.
#Publishable keys
A publishable key (vatpub_…) is public by design: it goes in page source
and inside an app, and selects one workspace. It does not
change the agent or open the workspace's inbox. Never put a secret key
(vsk_) in a browser or an app.
One key serves every build of the app. A publishable key made for the team's
version (listed as Test in the inbox, environment: "preview" in the
MCP's list_api_keys) keeps working: it talks to the newest version, and its conversations count as your
team's, not your customers'. Put the key get_status returns in the app
instead, in development and production alike.
A publishable key works from any site or app: any https:// origin (and
http://, http://localhost and http://127.0.0.1 on any port included), an
iOS app (ios-app://…) and an Android app (android-app://…). The same rule
covers the whole public API: the widget, the browser SDK and the
iOS, Android and Flutter SDKs.
No key keeps a list of allowed origins (a key that had one before November
2026 works from any site now), and none is needed. The Origin
header binds only a browser; any other client sends whatever origin it likes,
so a list of sites would not keep data safe. What protects data is elsewhere:
a publishable key only opens anonymous conversations, a
private tool runs only with the visitor's signed
token (Sessions and channels), and the public API
is rate limited per IP.
The one call refused for its origin is a call that names none: with neither
an Origin nor a Referer header it gets 403 origin_not_allowed, because a
public API call comes from a page or an app that names its origin. A browser
always sends one, and the iOS, Android and Flutter SDKs send ios-app:// plus
the bundle id or android-app:// plus the package name. No origin is ever
refused for not being on a list.
To have a key of its own for one site or app, to revoke it apart from the
others, make one under Settings → API keys in the inbox or with the MCP's
create_api_key:
{ "workspace": "acme", "label": "website" }It answers with the new vatpub_ key. revoke_api_key with the key's
prefix, as list_api_keys shows it, revokes one; Vatio's own managed keys,
such as the install snippet's, cannot be revoked.
#Where a key is used
Vatio records each origin a publishable key is used from, with when it was
first and last seen, so you can trace where a key runs. Open the key under
Settings → API keys in the inbox: Used from lists them, latest first.
The MCP's list_api_keys returns the same as each publishable key's
seen_origins, latest first. Vatio's own pages are not recorded. The record is for
traceability only: it never refuses a call.
#From your app's code
With a bundler, install the widget from npm and mount it yourself. It is the
same widget, with the same options as the data-* attributes, in camelCase:
npm install @vatio-ai/widgetimport { mountVatioWidget } from "@vatio-ai/widget";
const widget = mountVatioWidget({ workspace: "acme", token: "vatpub_REPLACE_ME" });
widget.identify(jwt); // who is signed in now, or null to sign outwidget.unmount(); // closes the connection and removes the widgetIn React, mount it in an effect and return widget.unmount as its cleanup.
There is one widget per page: a second mountVatioWidget does nothing until
the first is unmounted. The widget is open source (MIT), at
github.com/vatio-ai/widget.
The inbox's Web chat page shows the install snippet and edits the
widget's look, and Settings → API keys lists the keys, shows where each
was used from and revokes one. Through the MCP, get_settings returns the
install snippet (in widget), list_api_keys lists keys with where each was used from, and
revoke_api_key revokes one.
Revocation prevents new chats and conversation lists with that key; existing
chat credentials remain valid until expiry.
#The vatio:chat event
The widget tells the page which conversation it is in with a vatio:chat
event on window, the same with the script tag and with mountVatioWidget.
It is a stable part of the widget: its name and the fields of detail do not
change within /v1/ or a major version of @vatio-ai/widget.
detail field | Value |
|---|---|
chatId | The conversation's id: the id the MCP's list_conversations and get_conversation use, the one at the end of the conversation's inbox URL, and chat.id in webhooks. A number; compare it as a string |
workspace | The workspace's slug, the tag's data-workspace |
environment | live for your customers' conversations, preview for your team's (a page on localhost or a private address, see above) |
settled | false when the widget connects to a conversation, true once the visitor's first message in it has been stored |
It fires with settled: false each time the widget connects to a
conversation: a new one, the one it resumes after a reload, or one the visitor
reopens from the list. It fires once more, with settled: true, after the
first message the visitor sends in that connection is stored; that is the
event to count, because a conversation nobody wrote in is not in the inbox,
Analytics or the export.
To send it to Google Analytics 4 through Google Tag Manager, push it onto the
data layer and fire a GA4 event tag on a Custom Event trigger named
vatio_chat_started, with vatio_chat_id as a parameter:
<script> window.addEventListener("vatio:chat", function (event) { if (!event.detail.settled) return; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: "vatio_chat_started", vatio_chat_id: String(event.detail.chatId), vatio_environment: event.detail.environment }); });</script>Vatio also keeps where each conversation came from (the page, the referrer and the campaign), with no code on your side: see Where conversations come from.
#Where conversations come from
When a visitor starts a conversation, the widget and the browser SDK send where the visit came from, and Vatio keeps it with the conversation:
| Field | What it is |
|---|---|
landing_page | The page the visitor entered your site on |
referrer | The page of another site that sent them there |
utm_source, utm_medium, utm_campaign, utm_content, utm_term | The campaign's parameters, from the landing page's URL |
gclid, fbclid | The Google Ads and Meta ad click ids, from the same URL |
The campaign is on the URL the visitor landed on, and the conversation often starts pages later, so the SDK reads the address as soon as the page loads and keeps the visit for the rest of the browser tab. A page that arrives with campaign parameters, or from another site, starts a new visit; a page reached from inside your site keeps the one there is. Both URLs are kept as origin and path only: the query string, which can carry tokens, emails and search terms, is never sent, and what is worth keeping from it has a field of its own. Each value is cut to 200 characters, and a URL to 500.
It is set once, when the conversation starts, and never changes. WhatsApp and Instagram conversations have none, and neither do conversations that started before November 2026.
The script tag (cdn.vatio.ai/v1/widget.js) always carries the newest SDK, so
a page with it needs nothing to start sending this. With @vatio-ai/widget or
@vatio-ai/sdk from npm, it takes @vatio-ai/sdk 3.7.0 or later:
npm install @vatio-ai/sdk@latest. With the SDK,
Vatio.chat({ attribution }) sends your own instead of what it read from the
page, and attribution: false sends none (reference). Load
it on the page the visitor lands on, not only where the chat is, or the
campaign on that page's URL is gone by the time they write. The iOS, Android
and Flutter SDKs send none: an app has no landing page.
#Reading it
The same data, and the same filters, in the inbox and the MCP:
-
In the inbox, Analytics has Where conversations come from: the period's conversations by campaign, source, medium, landing page and referrer, each against the period before and with its ratings, the conversations with a reported reply and the ones a person answered. A value opens its conversations in Conversations; the campaign picker next to the period narrows the whole page (Analytics). An open conversation's header says where it came from, with every field in its tooltip.
-
From your coding agent, ask it which campaigns bring conversations, or how one went. The MCP's
get_analyticswithquery: originsreturnsorigins, andlist_conversationsreturns each conversation with itsattribution. Both takeutm_campaign,utm_source,utm_medium,landing_pageandreferrerto narrow what they count or list to the conversations that came from there; an empty string is the ones with none. For example, theseget_analyticsarguments count one campaign's conversations of the last 30 days by where they came from:{ "workspace": "acme", "query": "origins", "days": 30, "utm_campaign": "black-friday" } -
In your own analytics, send the
vatio:chatevent to Google Analytics or anything else, and join onchatId: it is the conversation's id in the MCP, the inbox and webhooks.
origins, in get_analytics:
| Field | What it is |
|---|---|
conversations | The period's conversations, after the filter |
attributed | How many of them have any of the fields above |
campaigns | Every campaign of the period, { value, conversations }, whatever the filter: what to filter by |
dimensions | One entry per utm_campaign, utm_source, utm_medium, landing_page and referrer: rows, the ten biggest values, and more, how many were left out |
Each row is { value, conversations, previous_conversations, ratings, reported, handed_off }: the value (null is the conversations without one, WhatsApp and
Instagram included), how many started in the period and in the one before, the
visitors' good, neutral and bad ratings, the conversations with a
reported reply and the ones a person on the team answered.
#Widget configuration
Visual values resolve in this order: page override, workspace setting, platform
default. Set the shared defaults with the MCP's update_widget (the name,
about and color with update_business) or in Web chat in the inbox, and
use data-* attributes for a specific page. The logo is uploaded in the
inbox only, on the Web chat page.
These settings belong
to the workspace, not to a version of the agent: everyone, your team included,
has them as soon as you save, with no tests to wait for.
update_widget replaces the whole set: pass every setting you want, as
get_settings shows it in widget, because a field left out stops applying. locale goes
beside settings:
{ "workspace": "acme", "settings": { "title": "Acme help", "greeting": "Hi! Ask me about your order.", "suggestions": ["Products", "Track an order"], "position": "right", "scheme": "auto", "reply_style": "stream" }, "locale": "es"}The business's name, logo, brand color and about are the Name and brand
card of the same page, or the MCP's update_business (all but the logo), and
are marked † below. The rest is the page's other cards.
| Field | Page attribute | Value / default |
|---|---|---|
accent_color † | data-accent | #RRGGBB brand color |
accent_ink | data-accent-ink | #RRGGBB; otherwise automatic contrast |
surface, ink, muted, line | data-surface, data-ink, data-muted, data-line | #RRGGBB theme colors |
scheme | data-scheme | auto, light, or dark; default auto |
position | data-position | right or left; default right |
reply_style | data-reply-style | stream: one answer, written out as it arrives. paced: short messages, each after a typing indicator, as on WhatsApp and Instagram. Default stream |
font | data-font | CSS font stack; inherit uses the host's font |
radius | data-radius | CSS length such as 16px; default 16px |
title | data-title | Up to 200 characters; defaults to the agent's name |
greeting | data-greeting | Up to 200 characters; defaults to localized copy |
suggestions | data-suggestions | Up to four prompts, 200 characters each; attribute uses pipe-separated text |
about † | data-about | Up to 2,000 characters of visitor-facing copy |
locale | data-locale | en, es, or pt; default en |
| Logo † | — | PNG, JPEG, WebP, or GIF upload, up to 2 MB |
about is displayed to visitors; what the agent knows about the business is
its instructions. locale sets interface labels; the agent's
language follows the conversation.
For example, data-suggestions="Products|Track an order" sets two prompts.
The widget normally waits for page load and idle time; data-eager="true"
starts it immediately.
To tell the agent who is signed in, render a visitor token onto the same tag — see Sessions and channels. To build your own UI instead of embedding this one, use the browser SDK.
A link the agent gives as a button is drawn as a button under the reply, in the accent color, with the agent's text on it, and opens in a new tab. The reply's text no longer shows that link.
#Visitor feedback
The widget asks how the conversation went at one of two moments. A few seconds after the agent's last message, when Jev detects that the visitor closed the topic and nothing is pending. Or, since most visitors leave without saying so, two minutes after the agent's last message if the visitor has written at least twice, has not written since, and the conversation shows it ended: the agent gave them what they asked for, or everything they need to finish it on their own, and is not waiting on an answer from them. Jev reads the latest 12 user and assistant messages (up to 4000 characters each); a visitor who writes again before either moment is not asked after that reply. Nobody is asked while a person has taken over. The question is written for that conversation in the agent's voice, and falls back to “How did [agent name] help you?” when it cannot be.
To never ask, turn it off with update_agent and {"ask_for_rating": false}, or untick it in Name and personality on the inbox's Agent page. It stops in your app and on WhatsApp too, and reaches everyone like any change to the agent: the team at once, everyone once its tests pass.
Feedback is offered at most once per conversation, and to the same contact at most once every 30 days, whether they answered or not: Good, So-so, or Bad, with an optional comment of up to 2000 characters for So-so and Bad. Visitors can skip it or continue chatting. Ratings appear in the inbox separately from supervisor ratings, and in visitor_feedback on the developer chat API. Each one, and a comment added to it later, also reaches your backend as a feedback.submitted webhook. From then on the agent knows the rating if the visitor writes again; on WhatsApp, where the rating is a message, it also answers it.