Skip to main content

Next.js

Don’t paste the raw tags into a component: init() can run before the script has loaded. Use next/script and put the component in your root layout, which stays mounted as visitors move between pages.
Calling init() twice is safe: the second call is ignored, so a remount never adds a second chat.

React (Vite and others)

useFrictionless.ts

TypeScript

Types for window.Frictionless are at usefrictionless.com/widget/v1.d.ts. Save the file into your project, for example as types/frictionless.d.ts.

Loading it async

With async or defer, the script may arrive after your own code runs. The chat queues calls until it does, so init(), identify() and track() are safe to call at any time:

Single-page apps

Load the chat once, in a layout that stays mounted. It keeps its conversation and open state as visitors move between pages, with or without a full page load. To tell agents where the visitor is, call track() when the route changes, for example track("Viewed pricing").