re
react
React
Inject the embed script once in your root layout or index.html.
Install in a React app
Option A — public/index.html (CRA / Vite HTML)
Add the script before </body>:
<script async src="https://app.owni.chat/widget/embed.js" data-project-key="YOUR_PROJECT_KEY"></script>
Option B — React effect (SPA)
Load the script once from your root component:
import { useEffect } from 'react';
const PROJECT_KEY = 'YOUR_PROJECT_KEY';
export function OwniChatWidget() {
useEffect(() => {
if (document.querySelector('script[data-owni-chat]')) return;
const script = document.createElement('script');
script.async = true;
script.src = 'https://app.owni.chat/widget/embed.js';
script.dataset.projectKey = PROJECT_KEY;
script.dataset.owniChat = '1';
document.body.appendChild(script);
}, []);
return null;
}
Render <OwniChatWidget /> near the root of your app (for example next to your router).
Then verify with Check installation in the dashboard.
Ready to install?
Create a free account, open your project Installation page, and paste the embed code.
Start free