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:
| Field | Type | Description |
|---|---|---|
name | string | Visitor's name |
email | string | Visitor's email |
phone | string | undefined | Phone number (if provided) |
conversationId | string | null | Linked conversation ID |
domainId | string | Your domain ID |
pageUrl | string | Page 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:
| Field | Type | Description |
|---|---|---|
rating | number | Star rating (1–5) |
tag | string | undefined | The tag from createPopup config |
feedback | string | undefined | Text feedback (if provided) |
pageUrl | string | Page 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" });
});