Widget API reference
After setting up your onBambuserWidgetReady handler (example below) you can start customizing the behavior of your widget.
<head>
<script>
window.onBambuserWidgetReady = widget => {
// widget = Bambuser Widget API
};
</script>
</head>
Constants
A list of available constants to be used throughout the widget integration.
widget.EVENT.CHANNEL
Events specific to the Channels widget. Use widget.on() to register an event listener (described further down).
-
.PRESENT
The Channel widget is rendered inside the embedded container.
Example:
widget.on(widget.EVENT.CHANNEL.PRESENT, (eventData) => {
console.log('🧩 Triggered event: widget.EVENT.CHANNEL.PRESENT');
console.log('🧩 Event payload:', eventData);
});
Event payload
| Content | Description | Type |
|---|---|---|
containerId | Bambuser Channel widget container ID attached to the data-bambuser-liveshopping-widget-id attribute | String |
playlists | List of playlists including details and shows' data. | Array |
locale | The effective locale code ex. en-US | String |
-
.PLAY
Triggered after a user triggers the player by clicking on a show.
Example:
widget.on(widget.EVENT.CHANNEL.PLAY, (eventData) => {
console.log('🧩 Triggered event: widget.EVENT.CHANNEL.PLAY');
console.log('🧩 Event payload:', eventData);
});
Event payload
| Content | Description | Type |
|---|---|---|
showId | ID of the show that is played through Channel | String |
showTitle | Title of the show | String |
showStatus | Could be 'live', 'recorded', 'scheduled', or 'upcoming' | String |
-
.SHARE
A show's 'share' button is clicked from the Channel widget.
Example:
widget.on(widget.EVENT.CHANNEL.SHARE, (eventData) => {
console.log('🧩 Triggered event: widget.EVENT.CHANNEL.SHARE');
console.log('🧩 Event payload:', eventData);
});
Event payload
| Content | Description | Type |
|---|---|---|
showId | ID of the show that is played through Channel | String |
showTitle | Title of the show | String |
showDescription | Description of the show | String |
showStatus | Could be 'live', 'recorded', 'scheduled', or 'upcoming' | String |
scheduledStartAt | Scheduled show time to go Live | String ( ISO 8601 ) | null |
shareUrl | Share URL by default uses the current page as the based URL. Configure shareBaseUrl | String |
-
.ADD_TO_CALENDAR
The 'add to calendar' button of a show on the Channel widget is clicked.
Example:
widget.on(widget.EVENT.CHANNEL.ADD_TO_CALENDAR, (eventData) => {
console.log('🧩 Triggered event: widget.EVENT.CHANNEL.ADD_TO_CALENDAR');
console.log('🧩 Event payload:', eventData);
});
Event payload
| Content | Description | Type |
|---|---|---|
showId | ID of the show that is played through Channel | String |
showTitle | Title of the show | String |
showDescription | Description of the show | String |
showStatus | Could be 'live', 'recorded', 'scheduled', or 'upcoming' | String |
scheduledStartAt | Scheduled show time to go Live | String ( ISO 8601 ) |
shareUrl | Share URL by default uses the current page as the based URL. Configure shareBaseUrl | String |
widget.EVENT.FLOATING
Events specific to the Floating Action Button (FAB). Use widget.on() to register an event listener (described further down).
-
.PRESENTEmitted on the page load when the FAB widget is present on the page.
Example:
widget.on(widget.EVENT.FLOATING.PRESENT, (eventData) => {
console.log('🧩 Triggered event: widget.EVENT.FLOATING.PRESENT');
console.log('🧩 Event payload:', eventData);
});Event payload
Content Description Type containerIdBambuser FAB widget container ID attached to the data-bambuser-liveshopping-widget-idattributeStringpresentWhether the widget is visible or not BooleanshowIdID of the show presented on the FAB StringshowStatusCan be liveorrecordedStringpositionContains the widget position information Objectposition.initialPossible values: Bottom leftorBottom right.
The initial position can be changed through the Widgets > FAB setup page in the workspace.Stringposition.offsetReturns the effective offsets. How to apply custom offsets Objectposition.offset.xEffective offset in the X axis. Numberposition.offset.yEffective offset in the Y axis. Number
-
Triggered after a user triggers the player by clicking on the FAB preview video..PLAY
Example:
widget.on(widget.EVENT.FLOATING.PLAY, (eventData) => {
console.log('🧩 Triggered event: widget.EVENT.FLOATING.PLAY');
console.log('🧩 Event payload:', eventData);
});Event payload
Content Description Type containerIdBambuser FAB widget container ID attached to the data-bambuser-liveshopping-widget-idattributeStringshowIdID of the show presented on the FAB StringshowStatusCan be liveorrecordedString
-
Triggered after a user clicks on the FAB preview video while a redirection URL is set for FAB. The redirection URL can whether be set in the workspace on through FAB configurations code..NAVIGATE
Example:
widget.on(widget.EVENT.FLOATING.NAVIGATE, (eventData) => {
console.log('🧩 Triggered event: widget.EVENT.FLOATING.PLAY');
console.log('🧩 Event payload:', eventData);
});Event payload
Content Description Type containerIdBambuser FAB widget container ID attached to the data-bambuser-liveshopping-widget-idattributeStringshowIdID of the show presented on the FAB StringshowStatusCan be liveorrecordedStringredirectionIncludes the effective redirection details Objectredirection.urlURL of the landing page Stringredirection.targetRedirection target ex: _self,_blank,_parent, or_top. (Default:_self)String
-
-
.DISMISSTriggered when the FAB is dismissed (hidden). This action is only possible for FAB presenting a recorded show.
Example:
widget.on(widget.EVENT.FLOATING.DISMISS, (eventData) => {
console.log('🧩 Triggered event: widget.EVENT.FLOATING.DISMISS');
console.log('🧩 Event payload:', eventData);
});Event payload
Content Description Type containerIdBambuser FAB widget container ID attached to the data-bambuser-liveshopping-widget-idattributeStringshowIdID of the show presented on the FAB String
-
.CONDENSETriggered when the FAB is condensed. This action is only possible when FAB is showing a Live video.
Example:
widget.on(widget.EVENT.FLOATING.CONDENSE, (eventData) => {
console.log('🧩 Triggered event: widget.EVENT.FLOATING.CONDENSE');
console.log('🧩 Event payload:', eventData);
});Event payload
Content Description Type containerIdBambuser FAB widget container ID attached to the data-bambuser-liveshopping-widget-idattributeString
-
.EXPANDTriggered when the FAB is expanded to the preview player from the condensed mode. This action is only possible when FAB is showing a Live video.
Example:
widget.on(widget.EVENT.FLOATING.EXPAND, (eventData) => {
console.log('🧩 Triggered event: widget.EVENT.FLOATING.EXPAND');
console.log('🧩 Event payload:', eventData);
});Event payload
Content Description Type containerIdBambuser FAB widget container ID attached to the data-bambuser-liveshopping-widget-idattributeString
Methods
widget.configure(configuration)
This method accepts the configuration for your widgets.
widget.configure({
channel: {
// Configurations for Channel
},
fab: {
// Configurations for FAB
},
});
Below are the available configuration options:
Channel
-
configuration.channel.shareBaseUrlOverrides the base URL for creating a link to access the show for both Share and AddToCalendar features. The URL must be an absolute path and can include protocol (
http://orhttps://) and query parameters.Default:
window.location.hrefUsage example:
widget.configure({
channel: {
shareBaseUrl: 'https://example.com/live-shopping?referer=joe',
},
}); -
configuration.channel.uiHide specific elements of the Channel UI. Here are a list of available properties:
hideShareButtonhideShareListhideAddToCalendarButtonhideAddToCalendarList
Usage example:
widget.configure({
channel: {
ui: {
hideShareList: true,
hideAddToCalendarList: true,
},
},
});
Floating Action Button (FAB)
-
configuration.fab.redirectionA redirection URL to navigate user to after clicking on the Floating Action Button (FAB) to play the show. Properties:
url: A string containing an absolute or relative URL.
Note that in Bambuser workspace > Widgets > FAB, you can also set a redirection URL that takes precedence over the URL configured here.target: Redirection target ex:_self,_blank,_parent, or_top. (Default:_self)
Usage example:
widget.configure({
fab: {
redirection: {
url: 'https://mybrand.com/video-shopping',
target: '_blank',
},
},
});
Tracking Tags
-
configuration.trackingTagsA list of tags which should be included in all tracking events
Usage example:
widget.configure({
trackingTags: [{
key: 'customerId',
value: '123-abc',
}],
});
widget.on(eventName, eventHandler)
Registers an event listener for any event from the EVENT constants above.
Usage example:
widget.on(widget.EVENT.FLOATING.PRESENT, () => {
console.log('Floating widget presented');
});
widget.off(eventName, eventHandler)
Removes a previously registered event listener from receiving any more events.
The second parameter needs to be the same handler method provided at the time of registering the event listener.
Usage example:
// Define an event listener
const someEventHandler = () => {
console.log('Floating widget dismissed');
};
// Register the listener from this point. Any dismissal event
// will trigger the console.log above
widget.on(widget.EVENT.FLOATING.DISMISS, someEventHandler);
// Removes the registered listener from this point. Dismissal events
// will no longer trigger the console.log
widget.off(widget.EVENT.FLOATING.DISMISS, someEventHandler);
widget.removeAllListeners()
Removes all event listeners defined by widget.on() . Use this sparsely and with caution.
Usage example:
widget.on(widget.EVENT.FLOATING.PRESENT, (eventData) => {
console.log('Floating widget presented', eventData);
});
widget.on(widget.EVENT.FLOATING.DISMISS, (eventData) => {
console.log('Floating widget dismissed', eventData);
});
// After this point, the above listeners will not be triggered again
widget.removeAllListeners();
widget.setTrackingTags(trackingTags)
Adds a list of custom tracking tags to all Bambuser tracking events.
Usage example:
widget.setTrackingTags([
{
key: 'customerId',
value: '123-abc',
},
{
key: 'membership',
value: 'premium',
}
]);