Embedding your Aimdoc agent

For your users to interact with your agent, Aimdoc provides widgets you can plug into site by pasting a simple embed code.

Preview Widget in Dashboard

You can preview the widget directly in the Aimdoc dashboard. Navigate to an Agent, drill into the Agent Builder and click the "Preview" tab on the far right. Your widget will be displayed in the bottom right corner of the dashboard for you to test.


Promote your agent

Preview Widget on your site

Toggle the widget to site preview mode by toggling the switch to "Website". Submit the url of your site and click "Preview". It will open in a new tab and you can test the widget on your site before deploying.


Promote your agent
Promote your agent

Deploy Widget on your site

Copy and paste the embed code into your site and then publish or deploy. Aimdoc provides scripts for popular frameworks like React and Next.js. For website builders like Wix, Framer, Webflow and Squarespace, you can use the simple embed code for static sites. This should be placed wherever you can paste custom HTML into the <body> tag of your site.


Promote your agent

Here's an example using Aimdoc's embed code. Simply replace the agentId with the id of your agent.

<script>
(function() {
    function initAgent() {
        window.Agent.initAgentChat('ai-assistant', {
            agentId: '404ff453-4709-489a-ac3f-965db57a64d0'
        });
    }
    var script = document.createElement('script');
    script.src = 'https://app.aimdoc.ai/embedded.bundle.js';
    script.async = true;
    script.onload = initAgent;
    document.body.appendChild(script);
})();
</script>

Promote your agent

Was this page helpful?