Widget Events#
This section applies to the Widget integration only. When the widget runs inside your website it emits browser events so you can monitor critical milestones (conversion, payment handover, etc.) without polling APIs.
Listening to widget events#
Attach listeners to the window object from the page that embeds the widget:
window.addEventListener('frd-payment-is-success', event => {
console.log('Payment successful', event.detail.bookingId);
});
Quick overview#
Event name |
When it fires |
Best use cases |
|---|---|---|
|
After a payment succeeds and before the traveler reaches the confirmation page. |
Trigger analytics/marketing conversions, sync bookings with your CRM, or launch post-booking automations. |
Event payloads#
The widget sends structured objects inside event.detail. The shapes below are stable across environments.
frd-payment-is-success#
{
bookingId: 'string', // Unique Discover booking identifier
externalClientId?: 'string' // Optional tracking ID if you passed externalClientId
}
Tips:
externalClientIdhelps you reconcile this booking with your internal customer IDs.