General Usage
Do I need to call init()
every time a user visits my site?
- Script: No, the script auto-initializes.
- NPM: Yes, call
init()
once per page load, then callboot()
when the user is ready.
What’s the difference between Script and NPM integration?
- Script: Simple, auto-initialized, ideal for fast setup
- NPM: Gives you full control, TypeScript-ready, better for modern apps
Can I use Adopt AI with multiple users on the same page?
No. Adopt is built for single-user sessions. You must callshutdown()
before calling boot()
for a different user.
What happens if I call boot()
before calling init()
(NPM only)?
The SDK will throw an error. Always call and complete init()
before boot()
.
Can I call boot()
multiple times in a session?
Not recommended. Call it once per session. To change users, call shutdown()
first, then boot()
again.
What happens if I call boot()
before the widget container is rendered?
The agent may fail to load properly. Make sure <div id="adopt-widget-container"></div>
is in the DOM before calling boot()
.
How do I completely remove the agent from the page?
Callshutdown()
. This will unmount the agent UI and clean up the session.
Does Adopt support anonymous or guest users?
No. A uniqueuserId
is required. For guests, generate a temporary UUID for the session.
Integration & Environments
Can I use different API base URLs for different environments (staging, prod, etc.)?
Yes. Set theapiBaseUrl
in the boot()
call to match your current environment.
Is Adopt compatible with Next.js, Nuxt, or SSR frameworks?
Yes—with client-side precautions. Call SDK methods likeboot()
only in the browser (e.g. inside useEffect()
).
Does the SDK support iframe embedding?
We don’t currently recommend using Adopt in an iframe. Behavior may be limited or blocked due to sandboxing.Can I conditionally show different components (e.g. only Sidebar on some pages)?
Yes. You can dynamically configure theproducts
array in your boot()
call based on user or page context.
Authentication & Security
How do I handle auth token refreshes?
UsesetCopilotHeaders()
to update headers when your token refreshes.
Script Example:
Does Adopt AI support Content Security Policy (CSP)?
Yes. Adopt supports CSP nonces viadata-nonce
in script tags (for Script setup) or as a parameter in init()
(for NPM).
Customization & Targeting
Can I customize the look and feel of the agent widget?
Yes. All theming is handled in the Adopt dashboard → SDK Configuration section. This includes colors, fonts, icon styles, and UI elements.Can I control which users see the agent experience?
Yes. Use Targeting Rules in your Adopt settings to define exactly which users should see the Copilot. If a user doesn’t match, the Copilot won’t load—even ifboot()
is called.