Skip to main content
Every framework uses the same script tag. Pick the tab for your framework. For a floating widget on every page, add the tag with data-api-key to your root layout.
Use next/script with the data attributes. Add the component to your root layout. The widget then shows on every page.
app/layout.tsx
To start the widget from a component, remove data-api-key from the Script element. Then use the component from the React tab. Add 'use client' at the top of the component file, because init runs only in the browser.
In every sample, replace pl_live_... with your API key. Add your site to Allowed origins in the dashboard.

TypeScript

The React and Vue samples use window.PaperlinkAIChatQueue and the PaperlinkAI namespace. Add the types file to your project, as TypeScript types explains. Without it, TypeScript reports that these names do not exist.

Single-page apps

A floating widget stays on the page when your router changes the route. The widget is attached to document.body, so the conversation continues on the next route. Start it once, in the root layout or the root component. For an inline widget on one route, start it in the component of that route. Call destroy() when the component unmounts, as the samples above do. If the visitor returns to the route, the new widget shows the same conversation.

Inline mode

Put the widget inside a container on your page instead of a floating launcher.