Browser Events

Listen for widget events for ad pixels, CRM integration, and analytics

The UserBoost widget fires custom events on the parent window that you can listen to for integrations.

ticket-submitted

Fired when a visitor submits the contact form.

window.addEventListener("userboost:ticket-submitted", (event) => {
  const { name, email, phone, conversationId, domainId, pageUrl } = event.detail;

  // Example: send to Google Ads
  gtag("event", "conversion", {
    send_to: "AW-XXXXXXX/XXXXXX",
    value: 1.0,
    currency: "DKK",
  });

  // Example: send to your CRM
  fetch("/api/crm/lead", {
    method: "POST",
    body: JSON.stringify({ name, email, phone }),
  });
});

Event detail:

FieldTypeDescription
namestringVisitor's name
emailstringVisitor's email
phonestring | undefinedPhone number (if provided)
conversationIdstring | nullLinked conversation ID
domainIdstringYour domain ID
pageUrlstringPage where the form was submitted

popup-rating

Fired when a visitor submits a popup rating.

window.addEventListener("userboost:popup-rating", (event) => {
  const { rating, tag, feedback, pageUrl } = event.detail;

  // Example: send to analytics
  analytics.track("popup_rating", { rating, tag, feedback });
});

Event detail:

FieldTypeDescription
ratingnumberStar rating (1–5)
tagstring | undefinedThe tag from createPopup config
feedbackstring | undefinedText feedback (if provided)
pageUrlstringPage where the rating was submitted

Usage with Ad Pixels

Meta Pixel

window.addEventListener("userboost:ticket-submitted", () => {
  fbq("track", "Lead");
});

Google Ads

window.addEventListener("userboost:ticket-submitted", () => {
  gtag("event", "conversion", { send_to: "AW-XXXXXXX/XXXXXX" });
});