CDN Embed Integration
The fastest way to add Ozwell to any website. No build step, no framework required β just a single script tag.
Quick Startβ
Add this snippet to your HTML, just before the closing </body> tag:
<script
src="https://cdn.ozwell.ai/embed.js"
data-api-key="ozw_scoped_xxxxxxxxxxxxxxxx"
data-agent-id="agent_xxxxxxxx"
></script>
That's it! A chat widget will appear in the bottom-right corner of your page.
Getting Your Credentialsβ
1. Create a Scoped API Keyβ
- Log in to your Ozwell dashboard
- Navigate to Settings β API Keys
- Click Create Scoped Key
- Select the agent this key should access
- Configure permissions (typically "Chat Only" for frontend use)
- Copy the generated key (starts with
ozw_scoped_)
2. Find Your Agent IDβ
- Go to Agents in your dashboard
- Click on the agent you want to embed
- Copy the Agent ID from the settings panel
Configuration Optionsβ
Customize the widget using data-* attributes:
<script
src="https://cdn.ozwell.ai/embed.js"
data-api-key="ozw_scoped_xxxxxxxxxxxxxxxx"
data-agent-id="agent_xxxxxxxx"
data-theme="dark"
data-position="bottom-left"
data-primary-color="#10b981"
data-auto-open="false"
data-greeting="Hi! How can I help you today?"
></script>
Available Optionsβ
| Attribute | Type | Default | Description |
|---|---|---|---|
data-api-key | string | required | Your scoped API key |
data-agent-id | string | required | The agent ID to use |
data-theme | "light" | "dark" | "auto" | "auto" | Color theme |
data-position | "bottom-right" | "bottom-left" | "bottom-right" | Widget position |
data-primary-color | string (hex) | "#4f46e5" | Accent color |
data-width | string | "400px" | Chat window width |
data-height | string | "600px" | Chat window height |
data-auto-open | "true" | "false" | "false" | Open on page load |
data-greeting | string | Agent default | Initial greeting message |
data-placeholder | string | "Type a message..." | Input placeholder |
data-button-icon | string (URL) | Ozwell logo | Custom launcher icon |
JavaScript APIβ
The embed script exposes a global Ozwell object for programmatic control:
Open/Close the Widgetβ
// Open the chat window
Ozwell.open();
// Close the chat window
Ozwell.close();
// Toggle open/closed
Ozwell.toggle();
Send Messagesβ
// Send a message as the user
Ozwell.sendMessage('Hello, I need help with...');
// Set context data (passed to the agent)
Ozwell.setContext({
userId: 'user_123',
page: window.location.pathname,
customData: { ... }
});
Eventsβ
Privacy Note: Ozwell respects user privacy. The host site receives only lifecycle eventsβnever conversation content. Users can ask anything without fear of surveillance.
// Widget is ready
window.addEventListener('ozwell:ready', () => {
console.log('Widget loaded');
});
// Chat window opened
window.addEventListener('ozwell:open', () => {
analytics.track('Chat Opened');
});
// Chat window closed
window.addEventListener('ozwell:close', () => {
analytics.track('Chat Closed');
});
// User explicitly shared data (opt-in only)
window.addEventListener('ozwell:user-share', (event) => {
// Only fires when user chooses to share
console.log('User shared:', event.detail);
});
β οΈ No message content events: ozwell:message and ozwell:user-message do not exist. Conversation content is private between the user and Ozwell.
Examplesβ
Basic Embedβ
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<h1>Welcome to My Site</h1>
<p>Content goes here...</p>
<!-- Ozwell Chat Widget -->
<script
src="https://cdn.ozwell.ai/embed.js"
data-api-key="ozw_scoped_xxxxxxxxxxxxxxxx"
data-agent-id="agent_xxxxxxxx"
></script>
</body>
</html>
Dark Theme with Custom Positionβ
<script
src="https://cdn.ozwell.ai/embed.js"
data-api-key="ozw_scoped_xxxxxxxxxxxxxxxx"
data-agent-id="agent_xxxxxxxx"
data-theme="dark"
data-position="bottom-left"
data-primary-color="#f59e0b"
></script>
Auto-Open with Custom Greetingβ
<script
src="https://cdn.ozwell.ai/embed.js"
data-api-key="ozw_scoped_xxxxxxxxxxxxxxxx"
data-agent-id="agent_xxxxxxxx"
data-auto-open="true"
data-greeting="π Welcome! I'm here to help you find what you're looking for."
></script>
Triggered by Button Clickβ
<button onclick="Ozwell.open()">Chat with Us</button>
<script
src="https://cdn.ozwell.ai/embed.js"
data-api-key="ozw_scoped_xxxxxxxxxxxxxxxx"
data-agent-id="agent_xxxxxxxx"
></script>
Security & Privacyβ
Conversation Privacyβ
π Conversations are private by default. The dialogue between users and Ozwell is never shared with the host site. Users can ask any questionβeven ones they might feel are "dumb"βknowing their conversation stays between them and Ozwell.
Sharing is always opt-in: only when a user explicitly chooses to share information does it become visible to the host site.
Scoped Keys Onlyβ
β οΈ Never use general-purpose API keys in frontend code. Always use scoped keys that are restricted to specific agents and permissions.
Domain Restrictionsβ
For additional security, configure domain restrictions for your scoped key:
- Go to Settings β API Keys in your dashboard
- Edit your scoped key
- Add allowed domains under Domain Restrictions
- Only requests from listed domains will be accepted
Content Security Policy (CSP)β
If your site uses CSP headers, add Ozwell's domains:
Content-Security-Policy:
script-src 'self' https://cdn.ozwell.ai;
frame-src 'self' https://embed.ozwell.ai;
connect-src 'self' https://api.ozwell.ai;
Troubleshootingβ
Widget Not Appearingβ
- Check the console for JavaScript errors
- Verify your API key is valid and has correct permissions
- Check domain restrictions if configured
- Ensure the script loads after the page content
Widget Appears But Chat Failsβ
- Verify agent ID is correct
- Check API key permissions include chat access
- Review network tab for failed API requests
Styling Conflictsβ
The widget renders in an iframe, so styling conflicts are rare. If you need to adjust the container:
/* Adjust the widget container position */
#ozwell-widget-container {
z-index: 9999 !important;
}
Next Stepsβ
- Framework Integration β For React, Vue, Svelte apps
- Iframe Details β Deep dive on iframe security
- Backend API β Server-side integration