MojarMojar
Embed widget

Widget configuration

Every data-* attribute for the Mojar embed script, with defaults and examples.

The embed widget is configured entirely through data-* attributes on the <script> tag. The two required attributes identify your agent and domain; all others are optional.

Script tag structure

Basic embed snippet
<script
  src="https://app.mojar.ai/widget-mojar-loader.js"
  data-agentid="YOUR_AGENT_ID"
  data-domainuuid="YOUR_DOMAIN_UUID"
></script>

Add the tag just before the closing </body> element. The script self-protects against being included more than once — if the page loads it twice, the second instance exits immediately.

Attribute reference

Required attributes

Prop

Type

Button attributes

Prop

Type

Prop

Type

Branding and appearance

Prop

Type

Visitor identity

Prop

Type

Examples

Minimal — just the required fields
<script
  src="https://app.mojar.ai/widget-mojar-loader.js"
  data-agentid="YOUR_AGENT_ID"
  data-domainuuid="YOUR_DOMAIN_UUID"
></script>

This renders a floating Ask AI button in the bottom-right corner using the default Mojar color scheme.

Customized — colors, position, branding
<script
  src="https://app.mojar.ai/widget-mojar-loader.js"
  data-agentid="YOUR_AGENT_ID"
  data-domainuuid="YOUR_DOMAIN_UUID"
  data-button-position="bottom-left"
  data-button-text="Chat with us"
  data-background="#1a1a2e"
  data-accent="#e94560"
  data-textColor="#ffffff"
  data-cardColor="#16213e"
  data-infoTextColor="#999999"
  data-project-logo="https://yoursite.com/logo.png"
  data-user-name="Visitor"
  data-contactEmail="support@yourcompany.com"
></script>

Using your own button

Set data-hide-button="true" to suppress the default floating button, then wire up your own element using the JavaScript API:

<!-- Your custom trigger -->
<button onclick="window.MojarAIWidget.toggle()">Ask AI</button>

<script
  src="https://app.mojar.ai/widget-mojar-loader.js"
  data-agentid="YOUR_AGENT_ID"
  data-domainuuid="YOUR_DOMAIN_UUID"
  data-hide-button="true"
></script>

The full JavaScript API:

window.MojarAIWidget.open();         // open the modal
window.MojarAIWidget.close();        // close the modal
window.MojarAIWidget.toggle();       // open if closed, close if open
window.MojarAIWidget.destroy();      // fully remove widget from DOM
window.MojarAIWidget.reinitialize(); // re-validate and recreate

window.MojarAIWidgetV2 is an alias for window.MojarAIWidget.

Guest chat and citations

All visitors chat as anonymous guests — no sign-in is required. Sessions use short-lived tokens that the loader refreshes automatically every 25 minutes, including when a browser tab regains focus after being backgrounded.

If the agent's knowledge base contains processed documents, the chat responses may include inline citation markers. Visitors can expand them to see the source excerpt.

Notes on attribute naming

HTML data-* attributes with hyphens map to camelCase in the JavaScript dataset API. Mojar's loader reads them using the camelCase form internally. For consistency, use the exact attribute names shown in this reference — for example, data-modalOpenByDefault (not data-modal-open-by-default) and data-textColor (not data-text-color).

On this page