advocate-widget
v0.4.0
Published
A lightweight chat widget that helps your website visitors decide to buy.
Readme
advocate-widget
A lightweight chat widget that helps your website visitors decide to buy. AI-powered, conversion-focused.
- Under 6kb gzipped
- No dependencies
- Shadow DOM isolates styles from your site
- TypeScript types included
Install
npm install advocate-widgetUsage
import { init } from 'advocate-widget';
const advocate = init({
siteKey: 'pk_live_xxxxx',
position: 'bottom-right',
global: false,
});
// Track conversions
advocate.trackConversion({ type: 'signup', value: 9.99 });Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| siteKey | string | — | Your publishable API key (required) |
| position | 'bottom-right' | 'bottom-left' | 'bottom-right' | Widget position |
| delay | number | 0 | Milliseconds before widget appears |
| greeting | string | — | Header greeting text (fetched from config if omitted) |
| global | boolean | true | Attach instance to window.Advocate |
| cta.text | string | — | Call-to-action button text |
| cta.url | string | — | Call-to-action URL |
Global vs Scoped
By default, the widget attaches to window.Advocate. Set global: false to get a scoped reference instead — useful in bundled apps where globals are discouraged.
See the full documentation for details.
License
MIT
