~10KB chat widget. Zero cookies. Zero tracking. Fully open source.
This is the open source client-side widget that powers GhostChat — a lightweight, privacy-first live chat for websites.
Quick Start
Add this script tag to your site:
<script src="https://api.ghostchat.dev/widget.js" data-site="YOUR_SITE_ID" async></script>
Sign up at ghostchat.dev to get your site ID.
What's Inside
A single TypeScript file that compiles to ~10KB gzipped. No frameworks, no dependencies.
- WebSocket real-time messaging — instant two-way communication
- File & image uploads — up to 5MB with inline preview, tap to open full-size
- Typing indicators — both visitor and agent, in real time
- Page journey tracking — SPA-aware, shows agents which pages the visitor browsed
- Visitor identity — optional name and email capture, required during away hours
- Presence detection — green/orange status dot, online/away via
visibilitychangeandbeforeunload - Quick links — configurable shortcut buttons above the message input
- URL auto-linking — URLs in messages become clickable links automatically
- Notification sounds — synthesized audio ding, no external files
- Unread badge — shows count on the launcher button
- Dark mode — respects
prefers-color-scheme - Customizable — position, colors, icon, welcome message via
data-*attributes
Privacy by Design
Don't take our word for it — read the code:
grep "document.cookie"→ 0 results — no cookies, evergrep "analytics\|tracking\|pixel"→ 0 results — no tracking scriptsgrep "fingerprint"→ 0 results — no browser fingerprinting- localStorage keys: only 5 (
ghostchat_session_id,ghostchat_session_secret,ghostchat_email,ghostchat_name,ghostchat_tooltip_shown) - All API calls go to your GhostChat API domain only — no third-party requests
- No CDN dependencies, no external fonts, no iframes from other domains
Size Comparison
| Widget | Gzipped Size | Cookies | Tracking |
|---|---|---|---|
| GhostChat | ~10KB | None | None |
| Intercom | ~200KB+ | Yes | Yes |
| Tawk.to | ~200KB | Yes | Yes |
| Tidio | ~200KB+ | Yes | Yes |
| Crisp | ~140KB | Yes | Yes |
| LiveChat | ~120KB | Yes | Yes |
Build from Source
git clone https://github.com/jacoborbach/ghostchat-widget.git
cd ghostchat-widget
npm install
npm run buildThe built widget will be at dist/widget.js.
How It Works
The widget is a single IIFE (Immediately Invoked Function Expression) that:
- Auto-detects the API URL from the
<script>tag'ssrcattribute - Creates a shadow-DOM-free chat UI injected at the end of
<body> - Opens a WebSocket connection for real-time messaging
- Falls back to polling if WebSocket fails
- Stores only a session ID in localStorage — no cookies, no fingerprinting
Self-Hosting Note
This widget connects to GhostChat's hosted API. You need a GhostChat account to use it. Sign up free — no credit card required.
Architecture
See How Our Widget Works for a visual breakdown of the architecture, privacy guarantees, and size comparisons.
License
MIT — see LICENSE.
Built by GhostChat.



















