How to Embed Chatbot Script into Different Platforms

This guide provides step-by-step instructions to help you embed the EmlyLabs chatbot widget on your website. You will need basic familiarity with HTML and the ability to edit the code of your web pages. Follow these steps to successfully integrate the ai chatbot script.

Prerequisites

  • Access to edit the HTML of your website.

  • The JavaScript snippet for embedding the chatbot widget, which is provided by EmlyLabs (similar to the one shown below).

Generate and place the Script

  • on the test bot screen you can customize the script or generate the embed script , ref images below
  • customize bot screen
  • get embed script

It is recommended to place the chatbot script just before the closing </body> tag for better performance and load order.

1. Embedding in HTML

To embed your chatbot script into a standard HTML website, follow these steps:

  1. Get the JavaScript Snippet: After deploying your chatbot, and followingthe above steps you’ll receive a JavaScript code snippet:
    Embed the Snippet:
    • Open your HTML file.
    • Place the JavaScript snippet right before the closing </body> tag.
  2. Example:

    <html>

    <head>
    <title>Your Website</title>
    </head>
    <body>
    <!-- Your Website Content -->

     

    <!-- Embed Chatbot Script -->
    <script type="text/javascript">
    ...
    </script>
    </body>
    </html>

  3. Save and Test: After adding the script, save your file and refresh the webpage to see the chatbot appear.

2. Embedding in WordPress

If you’re using WordPress, you can easily embed the chatbot script through widgets or page builders.

Option 1: Using WordPress Theme Customizer (Header/Footer Script)

  1. Go to WordPress Dashboard.
  2. Navigate to Appearance → Customize → Additional CSS/JavaScript or Theme Settings → Header/Footer Scripts (depending on your theme).
  3. Paste the JavaScript snippet in the Footer Scripts section:
    <script type="text/javascript">
    ...
    </script>
  4. Save the changes and refresh your website.

Option 2: Using a Plugin (Insert Headers and Footers)

  1. Install the Insert Headers and Footers plugin.
  2. After activation, navigate to Settings → Insert Headers and Footers.
  3. Paste the chatbot script into the Scripts in Footer section:
     
    <script type="text/javascript">
    ...
    </script>
  4. Click Save and check the front-end of your website

Deployment Tips

  • Cross-browser Testing: Make sure the chatbot works in all major browsers (Chrome, Firefox, Safari, Edge).
  • Mobile Responsiveness: Verify that the chatbot widget is mobile-friendly and works well on smaller screens.
  • Performance: Monitor your page’s load time to ensure the added script does not significantly slow down your website.

Troubleshooting

  • Widget Not Loading: If the chatbot does not load, ensure the script is correctly placed before the closing </body> tag and that all URLs (e.g., scriptSrc, logo, closeIcon) are accessible.
  • JavaScript Errors: Check your browser console for JavaScript errors. Common issues may be caused by incorrect URLs or network issues.
  • Custom Styling: If the widget’s default appearance does not align with your design expectations, adjust the properties like colors or logos directly in the script, or consult EmlyLabs’ support team for advanced styling options.

Additional Customization

  • Button Placement: You can change the widget’s location on the page by modifying the “launcherPosition” parameter.
  • Custom Images: Update “logo”, “openIcon”, and “closeIcon” properties to use custom images that align with your branding.
  • Behavior on Different Pages: If you have multiple pages and want different chatbot behavior, you can create different configurations of the script for each page.

Conclusion

Embedding the EmlyLabs chatbot widget in your website is a straightforward process that involves adding the provided script to your HTML. By following these instructions, you can easily offer automated support to your visitors, enhancing their experience with a helpful, interactive assistant.