Skip to content

Embed with a script tag

The chat button on a store page

<script src="https://api.example.com/widget/widget.js"
data-endpoint="https://api.example.com"
data-key="pk_…" async></script>

Put it before </body>. Add the page’s origin (for example https://www.shop.com) to Settings → Allowed websites; otherwise the session request is refused. If Settings → Guest sessions is off, the session request answers 403 and the chat only works with a token your server mints (see Signed-in customers). The script renders inside a Shadow DOM, so your CSS and its CSS do not leak into each other.

Attribute Effect
data-endpoint Required. The API base URL.
data-key Publishable key, for guest sessions
data-token A visitor token minted by your server (signed-in visitor)
data-channel Channel name (default web)
data-locale Widget language. By default it follows <html lang>, then the browser.
data-title Header title (overrides the theme)
data-color Main colour (overrides the theme)
data-position left or right
data-open="true" Open on load
data-expanded="true" Open in full screen ("false" forces the floating panel)

Everything else (theme, labels, card designs, sign-in settings) comes from your admin panel.

If your page has its own fixed bar at the bottom (a mobile tab bar), lift the launcher and the docked panel above it with a CSS variable on the widget’s host element:

@media (max-width: 767px) {
[data-helpvane-widget] { --helpvane-offset-bottom: 64px; }
}

The script tag sets window.Helpvane when it loads:

Method Effect
open(), close() Show or hide the panel
expand(), collapse(), toggleExpand() Full screen on desktop
setToken(token) Sign the visitor in with a token from your server. The chat switches to that customer.
setToken(null) Sign out: back to a fresh guest session
setContext(object) Context for guest sessions (≤ 8 KB), for example { page: 'cart', cartValue: 120 }
setLocale('tr') Change the widget and answer language
on('action', fn), off(...) Host callbacks from card buttons (guide)
on('status', fn) { status: 'solved' | 'escalated' | 'closed', data }
destroy() Remove the widget

The same events are dispatched on window as helpvane:action and helpvane:status CustomEvents, for code that loads before the widget:

window.addEventListener('helpvane:status', (event) => {
if (event.detail.status === 'escalated') analytics.track('chat_handover', event.detail.data);
});

window.HelpvaneWidget.mount(options) mounts without data attributes and returns the same API (it does not set window.Helpvane). Options: endpoint, publishableKey, token, channel, locale, labels, color, position, open, expanded, mode, context, theme, components, maxImageBytes, onAction, onNavigate, tools, onToolCall, describeApproval. The last four have no data attribute; see Site navigation, Client tools and the Widget API.

  • Their conversation is restored on every page while it is open; the anonymous session is stored in localStorage (helpvane:session).
  • Start a new conversation after the chat ends begins a new anonymous visitor.
  • Image upload (if the plan allows it), with a size check before sending.
  • Markdown answers. Links to your own site open in the same tab and the chat stays open; other links open in a new tab. See Site navigation.
  • Product, order and info cards, and quick-reply buttons.
  • On phones (480 px wide or less) the open chat fills the screen, and in full-screen mode on larger screens it covers the page. While it does, the widget locks your page’s scroll (it sets overflow: hidden on <html> and <body> and pins <body> with position: fixed at the current offset, which iOS Safari needs). Closing or collapsing the chat restores your inline styles and scrolls back to where the visitor was. Avoid scripts that rewrite body styles while the chat is open. App mode (data-mode="app") does not lock the page.
  • Shopify: paste the snippet into theme.liquid before </body>.
  • WooCommerce / WordPress: a code-snippets plugin, or your theme’s footer.
  • Magento: a CMS block or default_head_blocks.xml / a layout update in the footer.
  • Next.js: next/script with strategy="afterInteractive" in the root layout, or the React component.