Supported widgets: anything with a JavaScript snippet. Intercom, Crisp, Drift, Tidio, Tawk.to, Chatwoot, HubSpot Chat, Olark, LiveChat, Front — all work the same way.
Three Paths
- AI Chat (Fastest)
- Manual Code Editor
- Env Var (Next.js)
Ask the project AI:The AI finds your root layout, pastes the snippet in the right place, and adds a guard so the widget doesn’t load during development. Review and deploy.
The Generic Pattern
Sign up for the chat tool
Create an account with your chosen provider. Intercom, Crisp, Drift, etc. all have free or trial tiers.
Get your widget ID or script URL
Look in the provider’s dashboard under Settings > Install or Widget Code. They give you either a full
<script> snippet or an ID you drop into a provided template.Open your site's root layout
Depending on your stack:
- Next.js App Router:
app/layout.tsx - Next.js Pages Router:
pages/_document.tsx - Static HTML:
index.html - Other: whatever file wraps every page
Paste the snippet
Put it in the
<head> or just before </body>. Most providers recommend before </body> because it doesn’t block initial render.Example: Crisp
Paste this into your layout before</body>:
YOUR_CRISP_WEBSITE_ID with the ID from Crisp Dashboard > Website Settings > Setup Instructions.
Example: Intercom (React / Next.js)
Install the SDK:<IntercomBoot user={currentUser} /> once in your layout. If the user is logged out, leave user undefined and Intercom runs in anonymous mode.
Example: Tawk.to (Free, Simple)
Before</body>:
Cookie Consent
Basic gating pattern:<script> tag and only inject after consent. Your consent library (OneTrust, Cookiebot, or built-in) will have an event to hook into.
Performance Tips
Chat widgets typically add 50–200 KB of JS. To avoid slowing down first paint:- Load with
asyncordefer— most provider snippets already do this - Place script before
</body>rather than in<head> - Lazy-load after idle — for aggressive optimization, wrap the init in
requestIdleCallback - Don’t load on all pages — skip the widget on high-traffic SEO pages if support isn’t offered there
Customization
Most providers let you customize in their dashboard (no code):- Bubble color and position
- Greeting messages based on page or user segment
- Operating hours (automatic “we’re offline” messages)
- Pre-chat survey (name, email, reason for contact)
- Avatar and operator names
Using hiveku.json Build Env (Advanced)
For Next.js projects with per-environment widget IDs:
Set env vars
In Project > Settings > Environment Variables, add
NEXT_PUBLIC_CHAT_WIDGET_ID per environment (dev, staging, production).Test It
Deploy to production
Chat widgets rarely work in local dev due to provider allow-lists. Deploy to your Hiveku URL or custom domain.
Troubleshooting
Widget doesn't appear
Widget doesn't appear
Open the browser DevTools console on your live site. If there’s a script error (typo in the snippet, wrong ID, blocked by CSP), it’ll show there. Also check Network tab for the widget script URL — if it’s blocked or 404ing, the snippet or ID is wrong.
Widget appears but won't open
Widget appears but won't open
Usually an ad blocker or corporate firewall blocking the provider’s server. Try in an incognito window with extensions disabled. If it works there, document the fix — affected visitors can whitelist the domain.
Two chat widgets showing at once
Two chat widgets showing at once
The script got added twice — commonly once in the root layout and once in a per-page file (or via a plugin and manually). Remove one. Browser DevTools > Elements can help you find duplicate
<script> tags.Page load is slower after install
Page load is slower after install
Move the script from
<head> to just before </body>, and make sure it uses async or defer. If you need aggressive optimization, lazy-load the widget with requestIdleCallback or a 2–3 second delay — the user won’t miss a widget they can’t see yet.Widget loads before cookie consent
Widget loads before cookie consent
What’s Next?
Site Enhancements
Enable cookie consent and other site-wide features
Environment Variables
Store widget IDs per environment
CRM Contacts
Sync chat leads into your CRM