How to Add Asyntai AI Chatbot to ExpressionEngine
Step-by-step guide for ExpressionEngine CMS
Step 1: Get Your Embed Code
First, go to your Asyntai Dashboard and scroll down to the "Embed Code" section. Copy your unique embed code which will look like this:
<script async src="https://asyntai.com/static/js/chat-widget.js" data-asyntai-id="YOUR_WIDGET_ID"></script>
Note: The code above is just an example. You must copy your own unique embed code from your Dashboard as it contains your personal widget ID.
Step 2: Add to Template Layout (Recommended)
The easiest way to add the chatbot to all pages is by editing your main layout template in the ExpressionEngine control panel:
- In the EE control panel, go to Developer > Templates > Template Groups
- Open your main template group (usually "site") and edit the layout template (or the template that wraps all pages)
- Find the closing
</body>tag - Paste your Asyntai embed code just before the
</body>tag:<!-- Asyntai AI Chatbot --> <script async src="https://asyntai.com/static/js/chat-widget.js" data-asyntai-id="YOUR_WIDGET_ID"></script> </body> - Save the template
Tip: Adding the script before the closing </body> tag ensures it loads after the page content, which is recommended for chat widgets and won't slow down your page loading.
Alternative Method 1: Using EE Template Partials
ExpressionEngine Template Partials allow you to create reusable snippets that can be included across templates:
- Go to Developer > Templates > Template Partials
- Click "New" to create a new partial called
_asyntai_widget - Paste your Asyntai embed code into the partial content:
<script async src="https://asyntai.com/static/js/chat-widget.js" data-asyntai-id="YOUR_WIDGET_ID"></script> - Save the partial
- Include it in your layout template just before the closing
</body>tag:{embed="_asyntai_widget"} </body>
Note: Using Template Partials keeps your code organized and makes it easy to update the chatbot embed code in one place across your entire site.
Alternative Method 2: Using EE's HTML Header/Footer
Some ExpressionEngine setups provide a global footer section for adding scripts:
- Go to Settings > Content & Design > Global Template Preferences
- If your EE setup has a global footer section, paste the Asyntai embed code there
- If no global footer section is available, edit your main layout template directly and add the embed code before the closing
</body>tag:<!-- Asyntai AI Chatbot --> <script async src="https://asyntai.com/static/js/chat-widget.js" data-asyntai-id="YOUR_WIDGET_ID"></script> </body> - Save your changes
Alternative Method 3: Using config.php
For advanced users, you can inject the chatbot script through ExpressionEngine's configuration or by creating a custom add-on:
- Access your ExpressionEngine project files via FTP, SSH, or your code editor
- Navigate to the
system/user/config/directory and openconfig.php - For custom JavaScript injection, consider creating a simple EE add-on/extension that hooks into the
template_post_parsehook to inject the script on page render:// In your custom extension public function template_post_parse($final_template, $is_partial, $site_id) { $script = '<script async src="https://asyntai.com/static/js/chat-widget.js" data-asyntai-id="YOUR_WIDGET_ID"></script>'; $final_template = str_replace('</body>', $script . '</body>', $final_template); return $final_template; } - Replace
YOUR_WIDGET_IDwith your actual widget ID from the dashboard
Important: The config.php and add-on method is intended for advanced users comfortable with ExpressionEngine development. For most users, the template layout method (Step 2) or Template Partials method (Alternative Method 1) is recommended.
Step 3: Verify Installation
After saving your changes, visit your ExpressionEngine website in a new browser tab or incognito window. You should see the chat widget button in the bottom right corner. Click it to make sure it opens and works correctly.
Not seeing the widget? Make sure you saved the template and that you're editing the correct layout template that your pages use. Clear your browser cache or view in an incognito window. If ExpressionEngine template caching is enabled, clear the cache from the control panel under Developer > Utilities > Cache Manager.
Weebly