Skip to content

Popular

  • Embed not showing on my website
  • Connect Claude or ChatGPT (MCP)
  • Set up a custom domain
  • Order a build through Lumina
  • What Lumina Assistant can do

↑ ↓ to move · Enter to open · Esc to close

Developers

Embed JavaScript API

The loader script exposes window.LuminaEmbed on the page it runs on. Use it to feed demo activity into your own analytics, or to control embeds in a single-page app.

Availability

window.LuminaEmbed exists as soon as /embed.js has executed. The script is loaded async, so on a page that scripts against it immediately, guard the access.

function whenReady(fn) {
  if (window.LuminaEmbed) return fn(window.LuminaEmbed);
  document.addEventListener("DOMContentLoaded", function () {
    if (window.LuminaEmbed) fn(window.LuminaEmbed);
  });
}

Methods

MethodWhat it does
on(event, handler)Subscribe. The handler receives an object with the key of the embed that fired it.
off(event, handler)Unsubscribe the same function reference.
refresh()Mount any container added to the DOM since load. Safe to call repeatedly — an already-mounted container is skipped.
destroy()Remove every frame and drop every handler. Use it when a single-page app leaves the route.

Events

EventFires whenPayload
readyThe demo has loaded and is interactive.{ key }
resizeIts height changed. The loader has already applied it.{ key, height }
interactionThe visitor's first click or keypress inside the demo. Fires once per load.{ key }
call_startedA voice call connected.{ key }
call_endedThe call finished or was hung up.{ key }
leadThe visitor submitted their details.{ key }
open / closeThe bubble was opened or closed.{ key }
Events carry the embed key and nothing about the visitor. No name, email, transcript, or call content crosses into the host page. If you need the lead itself, read it in the Lumina dashboard — the event is a signal that one arrived, not the contents.

Example: send demo activity to your analytics

whenReady(function (Lumina) {
  Lumina.on("interaction", function (e) {
    gtag("event", "ai_demo_engaged", { embed: e.key });
  });

  Lumina.on("call_started", function (e) {
    gtag("event", "ai_demo_call", { embed: e.key });
  });
});

Example: a single-page app

// On route enter, after the container is in the DOM:
window.LuminaEmbed?.refresh();

// On route leave:
window.LuminaEmbed?.destroy();

Messages, if you would rather not use the wrapper

Underneath, each frame posts to its parent. Every message carries source: "lumina-embed", which is how you tell ours apart from every other widget on the page.

window.addEventListener("message", function (event) {
  if (event.origin !== "https://yoursubdomain.luminasales.io") return;
  if (!event.data || event.data.source !== "lumina-embed") return;

  // event.data.type is one of the events in the table above
});
Always check event.origin first. Any page on the internet can post a message into yours, and a handler that trusts event.data.source alone is trusting a string an attacker chose.

Creating and managing embeds

This script only runs embeds on a page. To create embeds, change their allowed domains or budgets, or fetch the install snippet from your own code, use the REST API (the embeds resources) or the MCP server. In the dashboard, Lumina Assistant can do all of it for you, including writing the snippet.