Back

How to embed your chatbot on a custom website

Adding your Ernie AI chatbot to a custom-built website is simple. If you or your developer can edit the site code, you can add Ernie in under a minute.

Before you start

  • Have your Ernie AI embed code ready.

  • Confirm you can edit the HTML files of your site.

  • We recommend adding Ernie at least on your homepage, then optionally across all pages.

Method A: Insert code directly into HTML

  1. Open your website’s HTML file in your editor or codebase.

  2. Find the closing </head> tag.

Paste your Ernie AI embed code directly above it.

Example placement:

<script>

[your ernie code here]

</script>

</head>

  1. Save the file.

  2. Deploy or refresh your site.

The chatbot should appear in the bottom-right corner on reload.

Method B: Insert using a template or shared layout

If your site uses reusable layout files (common in frameworks like React, Next.js, Laravel, Flask, Rails etc):

  1. Locate the global layout or head template file.
    Example names:

    • layout.html

    • head.html

    • _document.js

    • base.twig

    • app.blade.php

  2. Insert your embed snippet above the closing </head> tag.

  3. Save, rebuild as needed, and redeploy.

  4. Confirm the chatbot appears across all pages.

This method ensures Ernie appears site-wide.

Method C: Include using a shared footer file

Some sites inject scripts from the footer:

  1. Locate your site footer include file.
    Example names:

    • footer.html

    • partials/footer.php

    • includes/_footer.ejs

  2. Paste your Ernie AI embed snippet just before the closing body tag </body>.

  3. Save and reload.

This works as well, but </head> is preferred.

Troubleshooting and checks

  • Chatbot doesn’t show → confirm snippet is exactly as provided.

  • File caching → hard refresh or clear CDN cache.

  • Only visible on some devices → test on desktop and mobile.

  • Only visible on homepage → move snippet to a global layout file.

Need help?

Email [email protected] with:

  • your site URL

  • where you inserted the snippet

  • any screenshots if needed