Widget

Snippet reference

Every option on the script tag and every method on window.DuggAI, in one place.

The script tag

html
<script
  src="https://duggai.com/embed.js"
  data-key="duggsupp_pk_XXXXXXXXXXXX"
  defer
></script>

embed.js is a tiny loader: it renders the launcher immediately and lazy-loads the full widget bundle the first time someone opens it (or you call open()), so it costs almost nothing on page load.

Data attributes

AttributeDefaultNotes
data-keyrequiredYour public widget key. Starts with duggsupp_pk_. Without it the loader refuses to load.
data-streamtrueSet to "false" to disable streamed (SSE) replies — useful behind a strict CSP that blocks chunked responses.
data-bundleSet to "legacy" only if you hit a CDN cache mismatch; loads the older bundle filename.
Appearance is set in the dashboard
Accent color, logo, and header label come from your dashboard theme, not the script tag. That way you can restyle the bubble without redeploying your site.

JavaScript API

The widget exposes window.DuggAI once loaded. The legacy window.DuggSupport alias still works — both names resolve to the same object.

identify(user)

Tag the conversation with the signed-in user.

js
window.DuggAI.identify({
  id: "u_abc123",
  email: "alice@example.com",
  name: "Alice Smith",
  // optional metadata, sent to the agent for context
  traits: { plan: "pro", signupDate: "2025-04-12" },
});

For production, use HMAC-signed identify so users can't spoof other accounts.

open() / close()

Open or close the bubble programmatically. Useful for "Need help?" buttons.

js
document
  .querySelector("#help-button")
  .addEventListener("click", () => window.DuggAI.open());

setContext(ctx)

Set context that's included with the conversation so the agent knows where the user is and what they're doing.

js
window.DuggAI.setContext({
  workspaceId: "ws_42",
  framework: "next-15",
});

isVerified()

Returns true once the server has confirmed a signed identify hash for this session (see Identifying users). Returnsfalse for anonymous or unverified sessions.

Note
The widget loads asynchronously. The loader stubs window.DuggAI immediately and queues any identify() / setContext() / open() / close() calls — they replay in order once the heavy bundle lands. So calling DuggAI.identify(…) right after the <script> tag is safe.