SupaMaus

Embed API reference

Every data attribute, command, and window method the SupaMaus embed script exposes.

This is the reference for the drop-in embed.js script — the same widget covered in Quickstart, documented down to the attribute and method level.

The script tag

<script src="https://www.supamaus.com/embed.js" data-site-id="yourdomain.com" async></script>
AttributeDefaultWhat it does
data-site-idpage hostnameIdentifies which SupaMaus agent to load. Required in practice — without it the widget falls back to window.location.hostname, which breaks on staging domains, subdomains, or any URL that doesn't match what you claimed in the dashboard.
data-launcher"true"Set to "false" to hide the corner launcher dock. Use this if you're driving the widget entirely through window.supamaus(...) calls and don't want a visible entry point.
data-voice-captions"true"Set to "false" to hide live captions under the waveform while voice mode is speaking.
data-convex-urlproduction backendAdvanced — points the embed at a non-default backend deployment. Self-explanatory; you won't need this unless SupaMaus support asks you to set it.

The script tag itself is async, so it never blocks page render, and failures degrade to "the guide just doesn't appear" rather than a page error.

Calling before load

embed.js loads asynchronously, so code on your page can run before the widget has booted. To make calls safe regardless of timing, paste this bootloader ahead of the script tag — it stubs window.supamaus as a queue that replays every call once the real widget takes over:

<script>
(function () {
  window.supamaus = window.supamaus || function () {
    (window.supamaus.q = window.supamaus.q || []).push(arguments);
  };
})();
</script>
<script src="https://www.supamaus.com/embed.js" data-site-id="yourdomain.com" async></script>

With the stub in place, this is safe anywhere on the page, in any order:

supamaus('identify', { userId: 'u_123', name: 'Priya', plan: 'pro' })
supamaus('chat', 'how do I invite my team?')

Both calls queue instantly and drain in order the moment the widget finishes booting.

window.supamaus('command', ...) command reference

The queueable dispatcher. First argument is always the command name.

CommandArgsWhat it does
showOpens the floating prompt bar.
hideAborts any in-flight agent response and hides the prompt bar and response bubble.
toggleToggles the prompt bar open/closed.
chatquery: stringSends a message to the agent as if the user had typed it.
runWorkflowconfig: WorkflowConfig, options?Runs an inline workflow config directly, bypassing tour lookup.
runTourslug: string, options?Fetches and plays a published tour by its slug. Pass { autoRun: true } in options to have the tour perform its own clicks/fills instead of waiting for the user.
showBubbleShows the response bubble.
hideBubbleHides the response bubble.
guideinstruction: stringStarts voice-presentation pointing: the cursor flies to what's being described, without the text prompt bar or response bubble.
identifyuser: object | nullTells the agent who the current visitor is. Pass null (or omit) to clear an existing identity. See Identifying users below.
voiceenabled?: booleantrue starts voice mode, false stops it, omitted toggles it.
getStateReturns "initialized" once the widget has booted. Returns undefined (queued) before that.

Unknown command names are ignored with a console warning — nothing throws.

window.SupaMaus methods

Once the widget has booted, window.SupaMaus exposes the same actions as direct method calls (no command string):

MethodSignatureNotes
show()Opens the prompt bar.
hide()Aborts + hides prompt bar and bubble.
toggle()Toggles the prompt bar.
openPromptBar()Alias for show().
closePromptBar()Hides the prompt bar only.
showBubble()Shows the response bubble.
hideBubble()Hides the response bubble.
chat(query)query: stringSame as the chat command.
run(config, options?)config: WorkflowConfig, options?Same as the runWorkflow command.
runTour(slug, options?)slug: string, options?Same as the runTour command.
guide(instruction)instruction: stringSame as the guide command.
voice(enabled?)enabled?: booleanSame as the voice command.

window.SupaMaus only exists after boot — use the supamaus(...) queue (above) for anything that has to run before load. SupaMaus.session and SupaMaus.agent are internal engine handles; they aren't a stable API and can change without notice, so drive the widget through the methods above instead.

Identifying users

supamaus('identify', {
  userId: 'u_123',
  name: 'Priya Sharma',
  email: 'priya@acme.com',
  plan: 'pro',
})

Call this once your host page knows who the visitor is — typically right after auth resolves. The fields you pass are handed to the agent as context (folded into its system prompt) so replies can address the user by name, tailor advice to their plan, and so on.

This is context for generating replies, not data displayed anywhere — the agent never surfaces the raw object back to the page or other visitors. Pass whatever fields are useful; there's no fixed schema. Call supamaus('identify', null) on logout to clear it.

supamaus:ready postMessage

If you embed SupaMaus inside an iframe you control (rather than as a top-level script tag), the widget posts a ready signal to the parent frame once it has fully booted:

window.addEventListener('message', (event) => {
  if (event.data?.type === 'supamaus:ready') {
    // widget is booted and ready for commands
  }
})

For a normal top-level embed, you don't need this — window.supamaus(...) is always safe to call (see Calling before load), and supamaus('getState') returns "initialized" once booted.

Keyboard shortcuts

These work out of the box on any page with the widget mounted:

ShortcutAction
Cmd/Ctrl+KOpens the AI guide (launcher dock, or the prompt bar as a fallback).
Cmd/Ctrl+/Toggles voice mode.
EscDismisses. Press twice within 2 seconds for a hard reset (clears chat history and any active tour); a single press just hides the UI and preserves state to resume later.

Shortcuts are ignored while focus is inside a page <input>, <textarea>, or <select>, so they never fight with your own forms.

On this page