Skip to Content
🎉 Trogent Platform is live! Create your first AI agent

Website Widget Integration

Complete guide to embedding Trogent AI agents as chat widgets on your website for enhanced customer engagement and support.

Overview

Trogent’s website widget integration allows you to embed intelligent AI chat widgets directly into your website, providing visitors with instant access to AI-powered assistance. The widget appears as a customizable chat interface that can be positioned anywhere on your site.

Key Features

  • Easy Integration: Simple JavaScript embed code
  • Customizable Appearance: Colors, positioning, and sizing options
  • Auto-initiate Conversations: Proactive engagement with visitors
  • Mobile Responsive: Works seamlessly across all devices
  • Real-time Chat: Instant responses powered by your AI agent
  • Knowledge Base Integration: Access to your custom knowledge base
  • Analytics Tracking: Monitor visitor engagement and conversations

Prerequisites

Before integrating the website widget, ensure you have:

  • A website where you have permission to add JavaScript code
  • An active Trogent agent created and configured
  • Basic knowledge of HTML/JavaScript (or access to someone who does)

Setting Up Your Website Widget

Step 1: Configure Widget in Trogent

  1. Access your agent in the Trogent dashboard
  2. Navigate to Platform Configuration or click “Edit” on your agent
  3. Find the Website Widget section
  4. Configure widget settings:
    • Welcome Message: First message shown to visitors
    • Theme Colors: Primary and accent colors
    • Position: Bottom-right, bottom-left, or custom
    • Auto-initiate: Automatically start conversations
    • Enable/Disable: Toggle widget active status

Step 2: Customize Widget Appearance

Theme Configuration

  • Primary Color: Main widget color (header, buttons)
  • Secondary Color: Accent color (highlights, links)
  • Text Color: Message text color
  • Background Color: Chat background color

Position Settings

  • Bottom-Right: Standard position (recommended)
  • Bottom-Left: Alternative corner positioning
  • Custom Position: Specify exact pixel coordinates
  • Responsive: Automatic adjustment for mobile devices

Size Options

  • Compact: Smaller widget footprint
  • Standard: Default recommended size
  • Large: Expanded widget for better visibility
  • Custom: Specify exact dimensions

Step 3: Generate Embed Code

  1. Complete widget configuration
  2. Click “Generate Embed Code”
  3. Copy the provided JavaScript code
  4. Note the unique widget ID for your records

Example Embed Code

<script> (function(w, d, s) { var widgetId = 'trogent-widget-12345'; var script = d.createElement(s); script.async = true; script.src = 'https://widget.trogent.fun/embed.js'; script.setAttribute('data-widget-id', widgetId); script.setAttribute('data-agent-id', 'agent-67890'); var firstScript = d.getElementsByTagName(s)[0]; firstScript.parentNode.insertBefore(script, firstScript); })(window, document, 'script'); </script>

Step 4: Install Widget on Website

Standard Installation

  1. Copy the embed code from Trogent
  2. Paste before the closing </body> tag in your HTML
  3. Save and publish your website changes
  4. Test the widget by visiting your website

Content Management System Installation

WordPress
  1. Go to Appearance > Theme Editor
  2. Edit your theme’s footer.php file
  3. Paste the code before </body>
  4. Save changes
Shopify
  1. Go to Online Store > Themes
  2. Click Actions > Edit Code
  3. Edit theme.liquid file
  4. Paste code before </body>
  5. Save changes
Squarespace
  1. Go to Settings > Advanced > Code Injection
  2. Paste code in Footer section
  3. Save changes
Wix
  1. Go to Settings > Tracking & Analytics
  2. Click + New Tool > Custom
  3. Paste code and set to load on all pages
  4. Apply changes

Widget Configuration Options

Welcome Message Configuration

The welcome message is the first thing visitors see when the widget loads.

Best Practices for Welcome Messages

  • Keep it concise (under 100 characters)
  • Be friendly and inviting
  • Clearly state how you can help
  • Include a call-to-action

Example Welcome Messages

Customer Support: "Hi! I'm here to help with any questions about our products or services. How can I assist you today?" Sales Assistant: "Welcome! I can help you find the perfect product for your needs. What are you looking for?" General Help: "Hello! I'm your AI assistant. Feel free to ask me anything about our company or services." Technical Support: "Having technical issues? I'm here to help troubleshoot and guide you to a solution."

Auto-initiate Settings

Auto-initiate allows the widget to proactively start conversations with visitors.

Configuration Options

  • Delay: Time before auto-initiate triggers (5-60 seconds)
  • Trigger Conditions: Scroll percentage, time on page, exit intent
  • Frequency: How often to show auto-initiated messages
  • Page Targeting: Specific pages where auto-initiate is active

Auto-initiate Message Examples

Time-based: "I noticed you've been browsing for a while. Can I help you find something specific?" Scroll-based: "Interested in learning more? I'm here to answer any questions!" Exit-intent: "Wait! Before you go, is there anything I can help you with?"

Advanced Widget Settings

Availability Hours

Set specific hours when the widget is active:

  • Time Zones: Configure for your business location
  • Business Hours: Monday-Friday, custom weekend hours
  • Holiday Schedules: Disable during holidays or maintenance
  • Offline Messages: Custom messages when unavailable

Visitor Targeting

  • Geographic Targeting: Show widget to specific regions
  • Device Targeting: Desktop, mobile, or tablet specific
  • Traffic Source: Different behavior for different referrers
  • Return Visitor: Special handling for returning visitors

Integration Features

  • Lead Capture: Collect visitor information during conversations
  • CRM Integration: Connect with customer relationship management systems
  • Analytics: Track widget performance and user engagement
  • A/B Testing: Test different configurations

Customizing Widget Appearance

CSS Customization

For advanced customization, you can add custom CSS to modify the widget appearance:

/* Widget Container */ #trogent-widget-container { font-family: 'Your Custom Font', sans-serif !important; border-radius: 12px !important; box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important; } /* Widget Header */ #trogent-widget-header { background: linear-gradient(45deg, #your-color-1, #your-color-2) !important; border-radius: 12px 12px 0 0 !important; } /* Message Bubbles */ .trogent-message-user { background-color: #your-user-color !important; border-radius: 18px 18px 4px 18px !important; } .trogent-message-bot { background-color: #your-bot-color !important; border-radius: 18px 18px 18px 4px !important; } /* Input Field */ #trogent-widget-input { border: 2px solid #your-border-color !important; border-radius: 24px !important; }

Brand Integration

Logo Integration

  • Upload your company logo to display in widget header
  • Customize logo size and positioning
  • Add hover effects and animations

Color Scheme Matching

  • Match your website’s color palette
  • Use brand colors for consistency
  • Maintain accessibility standards

Typography

  • Use your website’s fonts
  • Maintain readable font sizes
  • Consider mobile readability

Widget Behavior and Features

Conversation Flow

Initial Interaction

  1. Widget Appears: Positioned according to your settings
  2. Welcome Message: Displayed automatically or on click
  3. User Input: Visitor types their first message
  4. AI Response: Agent provides intelligent response
  5. Conversation Continues: Natural back-and-forth dialogue

Conversation Memory

  • Session Persistence: Conversations persist during visit
  • Return Visitor Recognition: Remember previous interactions
  • Context Maintenance: Maintain conversation context
  • History Access: Users can scroll through conversation history

Interactive Features

Quick Reply Buttons

Add quick reply options for common queries:

{ "quickReplies": [ "Tell me about your products", "What are your business hours?", "How can I contact support?", "Show me pricing information" ] }

Typing Indicators

  • Typing Animation: Show when agent is composing response
  • Processing Indicators: Display during knowledge base searches
  • Response Timing: Natural delays for human-like interaction

File Sharing (Coming Soon)

  • Document Upload: Allow visitors to upload files
  • Image Support: Share screenshots and images
  • Download Options: Provide downloadable resources

Mobile Optimization

Responsive Design

  • Automatic Scaling: Adapts to screen size
  • Touch-Friendly: Large buttons and touch targets
  • Keyboard Handling: Smart keyboard appearance/disappearance
  • Orientation Support: Works in portrait and landscape modes

Mobile-Specific Features

  • Swipe Gestures: Swipe to minimize/maximize widget
  • Push Notifications: Browser push notification support
  • Offline Handling: Graceful offline experience
  • Performance Optimization: Fast loading on mobile connections

Analytics and Monitoring

Widget Performance Metrics

Engagement Metrics

  • Widget Views: How many visitors see the widget
  • Engagement Rate: Percentage who start conversations
  • Conversation Length: Average number of messages exchanged
  • Resolution Rate: Successful conversation outcomes

Technical Metrics

  • Load Time: Widget loading performance
  • Error Rates: JavaScript errors and failures
  • Browser Compatibility: Performance across browsers
  • Device Performance: Mobile vs desktop usage

Visitor Insights

Behavior Analysis

  • Page Views: Which pages generate most widget usage
  • Time on Site: Correlation between visit duration and widget usage
  • Traffic Sources: How different traffic sources engage with widget
  • User Journey: Path visitors take before using widget

Conversation Analysis

  • Common Questions: Most frequently asked questions
  • Topic Categories: What visitors are most interested in
  • Success Patterns: Conversations that lead to desired outcomes
  • Drop-off Points: Where conversations typically end

Best Practices

User Experience Design

Widget Positioning

  1. Bottom-Right: Standard and least intrusive
  2. Avoid Overlap: Don’t cover important content
  3. Mobile Considerations: Ensure easy thumb access
  4. Accessibility: Consider users with disabilities

Conversation Design

  1. Clear Introductions: Explain what the bot can help with
  2. Set Expectations: Be clear about bot capabilities and limitations
  3. Easy Escalation: Provide clear paths to human help
  4. Graceful Failures: Handle errors and unknown queries well

Performance Optimization

  1. Fast Loading: Optimize widget load times
  2. Minimal Impact: Don’t slow down your website
  3. Progressive Enhancement: Work even if JavaScript fails
  4. Caching: Use appropriate caching strategies

Content Strategy

Knowledge Base Optimization

  1. Relevant Content: Focus on visitor needs and questions
  2. Regular Updates: Keep information current and accurate
  3. FAQ Integration: Include frequently asked questions
  4. Product Information: Detailed product/service descriptions

Response Quality

  1. Consistent Voice: Match your brand personality
  2. Helpful Responses: Always try to be useful
  3. Clear Language: Use simple, understandable language
  4. Action-Oriented: Guide users toward next steps

Privacy and Compliance

Data Protection

  1. Privacy Notice: Include widget privacy information
  2. Data Minimization: Collect only necessary information
  3. Consent Management: Handle user consent appropriately
  4. Secure Transmission: Ensure encrypted data transmission
  1. Terms of Service: Include widget usage in terms
  2. Cookie Policies: Address any cookies used by widget
  3. Accessibility: Ensure compliance with accessibility laws
  4. International Laws: Consider GDPR, CCPA, and other regulations

Troubleshooting

Common Issues

Widget Not Appearing

  • JavaScript Errors: Check browser console for errors
  • Ad Blockers: Some ad blockers may block widgets
  • Network Issues: Ensure connection to widget servers
  • Configuration: Verify widget is enabled in Trogent dashboard

Performance Problems

  • Slow Loading: Check internet connection and server status
  • Memory Issues: Widget may use too much browser memory
  • Conflict: May conflict with other JavaScript on your site
  • Mobile Issues: Test thoroughly on various mobile devices

Conversation Issues

  • No Responses: Check agent status and configuration
  • Delayed Responses: May indicate server overload
  • Error Messages: Review agent knowledge base and settings
  • Broken Formatting: Check message length and formatting

Debugging Tools

Browser Developer Tools

  • Console: Check for JavaScript errors
  • Network: Monitor API requests and responses
  • Elements: Inspect widget HTML and CSS
  • Performance: Analyze widget impact on page load

Trogent Dashboard

  • Agent Status: Verify agent is active and responding
  • Error Logs: Check for system errors and issues
  • Analytics: Monitor widget usage and performance
  • Configuration: Review all widget settings

Advanced Features (Coming Soon)

Enhanced Integrations

  • CRM Connections: Automatic lead capture and syncing
  • E-commerce Integration: Product recommendations and purchases
  • Booking Systems: Appointment scheduling through widget
  • Support Ticketing: Automatic ticket creation for complex issues

AI Enhancements

  • Sentiment Analysis: Detect visitor emotions and adjust responses
  • Intent Recognition: Better understanding of visitor goals
  • Multilingual Support: Automatic language detection and responses
  • Voice Integration: Voice input and output capabilities

Advanced Analytics

  • Conversion Tracking: ROI measurement for widget interactions
  • Heat Maps: Visual representation of widget usage patterns
  • A/B Testing: Built-in testing for different configurations
  • Predictive Analytics: Predict visitor behavior and needs

This comprehensive guide should help you successfully integrate and optimize Trogent’s website widget for maximum visitor engagement and business value.