JavaScript API

The script tag creates one client and exposes it as window.signal. Calls never throw and never block your page: when something fails, a method returns null or false and the client emits an error event.

// Wait until Signal has a session (resolves within a few seconds, or carries on without).
await window.signal?.ready;
console.log(window.signal.visitorId);

Tracking events

window.signal.track("cta_clicked", { label: "Book a demo" });
window.signal.track("pricing_viewed");
  • type: letters, digits and _ . : -, up to 64 characters.
  • data: any small JSON object.
  • Events are batched and sent every 2 seconds (page_view, cta_clicked, pricing_viewed, resource_requested and contact_started go immediately), and on page hide.
  • Signal records page_view, engagement (time on the page) and, on Shopify, product_view by itself.
  • Event types listed under classifyOn in your configuration make Signal re-estimate the visitor straight away.

Identifying a visitor

When a visitor tells you who they are on your own forms or login, pass it on:

await window.signal.identify({
  name: "Robin Baker",
  email: "robin@example.com",
  company: "Bakery Robin",
  externalId: "user_123",          // your own id
  traits: { plan: "pro", seats: 12 },
});

All fields are optional. Only identify people who gave you these details themselves.

Reading what Signal knows

const profile = await window.signal.getProfile();
// {
//   visitorId: "vis_…",
//   identity: { name?: "Robin", company?: "…", emailKnown: true },
//   signals: { leadTemperature: { value: "hot", confidence: 0.86, label: "Lead temperature" } },
//   session: { pageViews: 4, engagedSeconds: 130, returningVisitor: true }
// }

Events

const off = window.signal.on("signal_changed", ({ key, value, confidence, previous }) => {
  if (key === "leadTemperature" && value === "hot") showSalesBanner();
});
off(); // unsubscribe
Event Payload When
ready { visitorId, sessionId, config } A session opened (or the ids changed).
profile_changed profile The visitor's profile changed.
signal_changed { key, value, confidence, previous? } An estimate changed.
question InteractionEvent Signal wants to ask a question.
offer InteractionEvent Signal wants to show an offer.
action InteractionEvent A configured browser action (message, link, …).
chat InteractionEvent The team is chatting with this visitor.
outcome { interactionId, routeId?, step } The visitor chose a route, gave details or declined.
form { formId, phase, runId? } A smart form started, moved a step, was submitted or ended.
next next interaction Every time Signal's next step changes.
identified profile After identify().
error Error A call failed (network, validation, rate limit).

Drawing your own UI

question, offer, action and chat events carry { interaction, preventDefault() }. Call preventDefault() to keep it out of the built-in popup and show it your way:

window.signal.on("question", (event) => {
  event.preventDefault();
  const { interactionId, question } = event.interaction;
  // question.input.type is "choice", "text" or "email"
  renderMyQuestion(question, (optionId) =>
    window.signal.answer({ questionId: question.id, optionId, interactionId }));
});

window.signal.on("offer", async (event) => {
  event.preventDefault();
  const { interactionId, offer } = event.interaction;
  // offer.routes: [{ id, type, label, effort, needs: [{ key, label, type }] }]
  const step = await window.signal.chooseRoute(interactionId, offer.routes[0].id);
  // step.step is "collect" (ask for step.fields), "open" (step.url), "done", "chat" or "products"
});

To turn the popup off entirely, add data-signal-popup="false" to the script tag.

Method Returns Use
answer({ questionId, optionId?, text?, interactionId? }) { next, profile } or null Answer a question.
dismiss(interactionId) boolean The visitor closed it.
chooseRoute(interactionId, routeId) step or null The visitor picked a route of an offer.
submitContact(interactionId, { routeId, fields, consent }) step or null Send the fields a collect step asked for.
declineOffer(interactionId) boolean "No thanks".
getNext() next interaction Ask for the current next step.

Smart forms from code

await window.signal.mountForm("#contact", "projectLead"); // element or selector, form key

// With what the page already knows: the form skips those questions; placement is kept with the visit.
const ok = await window.signal.mountForm("#contact", "request", { answers: { offer: "dedicated", whoFor: "agency" }, placement: "pricing-card" });
if (!ok) showOwnContactForm(); // false: the element isn't there, or the project is in shadow mode

Without code, the same on the holder (auto-mounted when Signal is ready):

<div data-signal-form="request" data-signal-answers='{"offer":"dedicated"}' data-signal-placement="pricing-card"></div>

Answers must be existing multiple-choice question and option ids; refused answers still mount the form, without them.

Calling Signal before it has loaded

The snippet loads asynchronously, so window.signal may not exist yet when your code runs (a fast cookie banner, your router's first navigation). Queue calls instead; they run in order once Signal starts, and right away after:

(window.signalQ = window.signalQ || []).push(["setConsent", { storage: "persistent", analytics: true }]);
(window.signalQ = window.signalQ || []).push(["pageType", "business-claimable"]);
(window.signalQ = window.signalQ || []).push(["identify", { traits: { owner: true } }]);

Queueable: setConsent, pageType, identify, track, open, mountForm, mountChat (results of open and the mounts aren't returned through the queue: call window.signal directly when you need them).

// After each navigation (single-page sites: in your router's after-navigation hook):
window.signal?.pageType("business-claimable"); // 1–40 lowercase letters, digits, - or _

// A signed-in owner (only a boolean, nothing personal):
window.signal?.identify({ traits: { owner: true } });
  • Page types let questions and offers depend on the kind of page ({ type: "page", pageType: "…" }), feed audiences, and make pages quiet (reach.quietOn.pageTypes). A new page view clears the type until you send the new one.
  • Your own popups and Signal take turns. Signal dispatches window CustomEvent("signal:popup", { detail: { open } }) when its popup opens or closes; dispatch CustomEvent("site:popup", { detail: { open } }) when yours does, and Signal waits while yours is open:
window.dispatchEvent(new CustomEvent("site:popup", { detail: { open: true } }));  // your newsletter popup opened
window.addEventListener("signal:popup", (e) => { if (e.detail.open) holdMyPopups(); });
  • Wait for your cookie banner: add data-signal-hold-until-consent to the snippet. Signal shows nothing until you call window.signal.setConsent({ storage: "persistent" | "session" }), or the snippet already says data-signal-storage (set it from the stored choice before the script loads, for returning visitors — for both accepted and refused).

The chat in your page

Put Signal's chat in your own page, e.g. a contact page, instead of the popup:

const ok = await window.signal.mountChat("#chat", {
  placement: "pricing-card",            // where the visitor came from, kept with the visit
  answers: { offer: "dedicated" },       // optional pre-answers (multiple-choice question and option ids)
  draft: "Our site is down",             // optional first message in the box, not sent
});
if (!ok) showOwnContactForm(); // false: shadow mode, no such element, no chat route, or Signal not ready in 4 s

Without code (mounted when Signal is ready):

<div data-signal-chat data-signal-placement="chat-page" data-signal-draft="Our site is down" style="height: 560px"></div>
  • It uses the project's chat route and its greeting, and follows the page's <html lang> like the rest of Signal.
  • A conversation opens in your Inbox when the visitor writes, not when the page loads.
  • While it's on the page the popup shows no chat and no questions there (offers still can).
  • It fills its container: give it a height (about 500–600px) and a width of 320px or more. It never moves focus on load.

Opening Signal from your own buttons

Your own buttons can open Signal's popup on a smart form or on the chat, with what the button already says pre-answered. No code needed:

<button data-signal-open="request" data-signal-answers='{"offer":"strip_card"}' data-signal-placement="pricing">
  Send the signal
</button>
<a href="/contact" data-signal-open="askUs">Ask us a question</a>
  • data-signal-open: a form's key or a chat route's key from your configuration.
  • data-signal-answers (optional): JSON of multiple-choice answers, {"question": "option"}. The form skips those questions. Free-text answers can't be pre-filled; they're the visitor's to write.
  • data-signal-placement (optional): where the button is. It's kept with the visit, so you can see which buttons work.
  • On a link, the href is the fallback: it's followed when Signal can't open (shadow mode, popup off, offline).

The same from code. It resolves true when the popup opened, and false when Signal can't show it, so you can fall back to your own form. It never throws.

const opened = await window.signal.open({ form: "request", answers: { offer: "emergency" }, placement: "hero" });
if (!opened) showOwnContactForm();
// or the chat:
await window.signal.open({ route: "askUs" });

Only chat routes open directly; other routes (a booking, a guide by email) are offered by Signal itself.

Bots

Signal tells people from bots and leaves bots alone: no popup, no AI, not counted as visitors. To tell them apart, the script sends three automation flags when they're true (navigator.webdriver, a headless browser, no languages) and one interaction event per page on the first scroll, tap or key press. It never records what was clicked or typed. The server adds the network the visit comes from (data centres only) and whether the browser says it's a crawler. In the dashboard, Insights → Bots & crawlers shows which search engines and AI tools read your site.

Language

Signal reads the page's <html lang> and uses it to pick the visitor's language (see Configuration → Languages). Keep it right on every page, also when your site switches language without a page load; nothing else is needed.

window.signal.setConsent({ storage: "persistent", analytics: true, personalisation: true });

See Consent and storage.

Other methods

Method What it does
reset() Forget this visitor and start a new anonymous one (e.g. on log-out).
lastErrorCode() The error code of the last failed call, e.g. "too_many_submissions".
destroy() Stop Signal on this page and remove the popup and forms.

DOM events

  • window receives signal:event (event.detail = { event, data }) for configured emit_event actions, when the built-in popup is on.
  • document receives signal:cart-added (event.detail = { variantId, handle }) when a visitor adds a recommended product to the cart from the popup.