Skip to page content
Docs
Make Agent Fast documentation

HTML and JavaScript

Install, configure, verify, and remove the floating agent with one public script.

At a glance

Install, configure, verify, and remove the floating agent with one public script.

Embed install pathLoader on your site talks to the hosted agent runtime
Your websiteHTML / appLoader scriptembed.jsWidget UIChat / voiceAgent

Prepare the site#

Publish the agent's site, open Embed, enable embedding, and add the final host-page origin. Add development and production separately; http://localhost:3000, https://example.com, and https://www.example.com do not match one another.

Install the script#

Paste the loader immediately before the closing </body> tag on every page that should show the launcher. Replace only the public site slug and optional presentation values.

<script
  src="https://makeagent.fast/embed.js"
  data-agent="YOUR_SITE_SLUG"
  data-position="right"
  data-label="Ask us"
  data-accent="#6d5ce7"
  data-locale="en"
  async
></script>

data-agent is required. The slug is public; no API key belongs in this tag. Omit optional attributes to inherit the site's appearance and automatic theme behavior. See Embed overview for every accepted value.

Choose site-wide or page-specific placement#

For a shared server-side template, place the script in the global layout/footer. For selected pages, include it only in those templates. Load the same slug once per document; duplicate same-slug tags are ignored, but removing duplicates keeps ownership and teardown predictable.

Do not paste the snippet into an HTML sanitizer or rich-text field that strips <script>. Confirm the rendered page source or Elements panel still contains the tag.

Remove or remount in an SPA#

Removing the script after it executes does not remove the launcher it already created. A route-specific client application must remove both the script and the slug-specific root before remounting:

const slug = "YOUR_SITE_SLUG";
document.getElementById("maf-agent")?.remove();
document.getElementById(`maf-embed-root-${slug}`)?.remove();

Prefer keeping one site-wide root mounted across client-side navigation so the active conversation is not discarded. If you remove the root, append a fresh embed.js script to create it again.

Verify in the browser#

  1. Open the deployed page in a private window.
  2. Confirm embed.js returns 200 and is not blocked by CSP/consent.
  3. Confirm one [data-maf-embed="YOUR_SITE_SLUG"] root exists.
  4. Open the launcher and confirm the /embed/YOUR_SITE_SLUG iframe loads.
  5. Send a question and confirm the thread in Conversations.
  6. Test mobile width and microphone permission when voice is enabled.

Troubleshooting#

SymptomFix
Console warns about missing data-agentPut the attribute on the exact embed.js tag
Script exists but launcher does notCheck publish/embed switches, exact origin, CSP, and consent state
Works on one hostname onlyAdd each actual scheme/host/port to the allowlist
Style differs from expectedCheck data-accent, data-theme, and saved site appearance
Voice fails inside iframeAllow microphone in browser and host Permissions Policy

Never proxy or copy the loader into an unreviewed local fork; use the hosted script so origin validation and fixes remain current.