Quick Start
Set up live chat in 5 minutes
Quick Start
Get live chat running on your website in just a few minutes.
Prerequisites
- A Transactional account
- An organization set up
- Access to your website's code
Step 1: Create an Inbox
- Navigate to Support > Inboxes
- Click Create Inbox
- Enter inbox details:
- Name: "Website Support"
- Description: "General website inquiries"
- Click Create
Step 2: Get the Embed Code
- Go to Support > Inboxes > Your Inbox > Settings
- Enable the Chat Widget toggle
- Scroll to the Embed Code section
- Copy the JavaScript embed code
Step 3: Add the Widget
Add this script before the closing </body> tag:
<!-- Transactional Support Widget -->
<script>
(function(w,d,s,o,n,f,js,fjs){
w[o]=w[o]||{};w[o][n]=w[o][n]||function(){(w[o][n].q=w[o][n].q||[]).push(arguments)};
w[o][n].l=1*new Date();js=d.createElement(s);fjs=d.getElementsByTagName(s)[0];
js.id=o+'_'+n;js.src=f;js.async=1;fjs.parentNode.insertBefore(js,fjs);
}(window,document,'script','Transactional','support','https://cdn.usetransactional.com/sdk/support.min.js'));
Transactional.support('init', { inboxId: 'YOUR_INBOX_ID' });
</script>Replace YOUR_INBOX_ID with your inbox ID from the settings page.
Step 4: Test the Widget
- Open your website
- Look for the chat bubble in the bottom right corner
- Click it to open the chat
- Send a test message
Step 5: Respond to Messages
- Go to the Support dashboard
- Click on Inbox
- You should see your test message
- Reply to it
The visitor will receive your reply in real-time.
Identifying Users
When users log in to your application, identify them:
// Call this when user logs in
Transactional.support('identify', 'user-123', {
email: 'john@example.com',
name: 'John Doe',
plan: 'premium'
});This links conversations to specific users and enables:
- Viewing user details in conversations
- Reaching out to specific users
- Building user profiles
Associate with Company
Link users to their company for B2B support:
Transactional.support('company', 'company-456', {
name: 'Acme Inc',
plan: 'enterprise',
industry: 'Technology'
});Track Events
Track user behavior for context in conversations:
Transactional.support('trackEvent', 'purchase_completed', {
orderId: 'order-123',
amount: 99.99
});React / Next.js Integration
Create a client component that loads the widget:
'use client';
import { useEffect } from 'react';
import { useUser } from './hooks/useUser';
declare global {
interface Window {
Transactional: {
support: (command: string, ...args: unknown[]) => void;
};
}
}
const SUPPORT_CDN_URL = 'https://cdn.usetransactional.com/sdk/support.min.js';
const INBOX_ID = process.env.NEXT_PUBLIC_SUPPORT_INBOX_ID;
export function SupportWidget() {
const { user, isAuthenticated } = useUser();
useEffect(() => {
(function(w,d,s,o,n,f,js,fjs){
w[o]=w[o]||{};w[o][n]=w[o][n]||function(){(w[o][n].q=w[o][n].q||[]).push(arguments)};
w[o][n].l=1*new Date();js=d.createElement(s);fjs=d.getElementsByTagName(s)[0];
js.id=o+'_'+n;js.src=f;js.async=1;fjs.parentNode.insertBefore(js,fjs);
}(window,document,'script','Transactional','support', SUPPORT_CDN_URL));
window.Transactional.support('init', { inboxId: INBOX_ID });
return () => {
window.Transactional?.support?.('shutdown');
};
}, []);
// Identify user when authenticated
useEffect(() => {
if (isAuthenticated && user) {
window.Transactional.support('identify', user.id, {
name: user.name,
email: user.email,
plan: user.plan
});
if (user.company) {
window.Transactional.support('company', user.company.id, {
name: user.company.name,
plan: user.company.plan
});
}
}
}, [isAuthenticated, user]);
return null;
}Add to your layout:
import { SupportWidget } from '@/components/support-widget';
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<SupportWidget />
</body>
</html>
);
}Environment Variables
Add to your .env file:
NEXT_PUBLIC_SUPPORT_INBOX_ID=your-inbox-idCommon Configurations
Show Widget After Delay
setTimeout(() => {
Transactional.support('show');
}, 5000);Show on Specific Pages
if (window.location.pathname.includes('/support')) {
Transactional.support('show');
} else {
Transactional.support('hide');
}Track Page Views (for SPAs)
router.events.on('routeChangeComplete', () => {
Transactional.support('trackPageView');
});Troubleshooting
Widget Not Showing
- Check browser console for errors
- Verify inbox ID is correct
- Check Content Security Policy allows the script
- Ensure the script is loaded
Messages Not Sending
- Check network tab for failed requests
- Verify WebSocket connection
- Check if user is rate-limited
User Not Identified
- Ensure
identifyis called afterinit - Check user ID is a string
- Verify user data is valid
Next Steps
- Chat Widget SDK - Full widget documentation
- Inboxes - Managing inboxes
- Conversations - Handling conversations
On This Page
- Prerequisites
- Step 1: Create an Inbox
- Step 2: Get the Embed Code
- Step 3: Add the Widget
- Step 4: Test the Widget
- Step 5: Respond to Messages
- Identifying Users
- Associate with Company
- Track Events
- React / Next.js Integration
- Environment Variables
- Common Configurations
- Show Widget After Delay
- Show on Specific Pages
- Track Page Views (for SPAs)
- Troubleshooting
- Widget Not Showing
- Messages Not Sending
- User Not Identified
- Next Steps