Skip to main content

Widget API reference

Bambuser Widget API reference guide

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>
caution

Note that the widget object and its properties (constants and methods below) are only accessible within the onBambuserWidgetReady method body.

You should define the onBambuserWidgetReady method before FAB and/or Channels widgets embed snippets.


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).

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
ContentDescriptionType
containerIdBambuser Channel widget container ID attached to the data-bambuser-liveshopping-widget-id attributeString
playlistsList of playlists including details and shows' data.Array
localeThe effective locale code ex. en-USString

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
ContentDescriptionType
showIdID of the show that is played through ChannelString
showTitleTitle of the showString
showStatusCould be 'live', 'recorded', 'scheduled', or 'upcoming'String

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
ContentDescriptionType
showIdID of the show that is played through ChannelString
showTitleTitle of the showString
showDescriptionDescription of the showString
showStatusCould be 'live', 'recorded', 'scheduled', or 'upcoming'String
scheduledStartAtScheduled show time to go LiveString ( ISO 8601 ) | null
shareUrlShare URL by default uses the current page as the based URL. Configure shareBaseUrlString

  • .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
ContentDescriptionType
showIdID of the show that is played through ChannelString
showTitleTitle of the showString
showDescriptionDescription of the showString
showStatusCould be 'live', 'recorded', 'scheduled', or 'upcoming'String
scheduledStartAtScheduled show time to go LiveString ( ISO 8601 )
shareUrlShare URL by default uses the current page as the based URL. Configure shareBaseUrlString

widget.EVENT.FLOATING

Events specific to the Floating Action Button (FAB). Use widget.on() to register an event listener (described further down).

  • .PRESENT

    Emitted 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
    ContentDescriptionType
    containerIdBambuser FAB widget container ID attached to the data-bambuser-liveshopping-widget-id attributeString
    presentWhether the widget is visible or notBoolean
    showIdID of the show presented on the FABString
    showStatusCan be live or recordedString
    positionContains the widget position informationObject
    position.initialPossible values: Bottom left or Bottom right.
    The initial position can be changed through the Widgets > FAB setup page in the workspace.
    String
    position.offsetReturns the effective offsets. How to apply custom offsetsObject
    position.offset.xEffective offset in the X axis.Number
    position.offset.yEffective offset in the Y axis.Number

    • .PLAY

      Triggered after a user triggers the player by clicking on the FAB preview video.

    Example:

    widget.on(widget.EVENT.FLOATING.PLAY, (eventData) => {
    console.log('🧩 Triggered event: widget.EVENT.FLOATING.PLAY');
    console.log('🧩 Event payload:', eventData);
    });
    Event payload
    ContentDescriptionType
    containerIdBambuser FAB widget container ID attached to the data-bambuser-liveshopping-widget-id attributeString
    showIdID of the show presented on the FABString
    showStatusCan be live or recordedString

    • 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.

    Example:

    widget.on(widget.EVENT.FLOATING.NAVIGATE, (eventData) => {
    console.log('🧩 Triggered event: widget.EVENT.FLOATING.PLAY');
    console.log('🧩 Event payload:', eventData);
    });
    Event payload
    ContentDescriptionType
    containerIdBambuser FAB widget container ID attached to the data-bambuser-liveshopping-widget-id attributeString
    showIdID of the show presented on the FABString
    showStatusCan be live or recordedString
    redirectionIncludes the effective redirection detailsObject
    redirection.urlURL of the landing pageString
    redirection.targetRedirection target ex: _self, _blank, _parent, or _top. (Default: _self)String

  • .DISMISS

    Triggered 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
    ContentDescriptionType
    containerIdBambuser FAB widget container ID attached to the data-bambuser-liveshopping-widget-id attributeString
    showIdID of the show presented on the FABString

  • .CONDENSE

    Triggered 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
    ContentDescriptionType
    containerIdBambuser FAB widget container ID attached to the data-bambuser-liveshopping-widget-id attributeString

  • .EXPAND

    Triggered 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
    ContentDescriptionType
    containerIdBambuser FAB widget container ID attached to the data-bambuser-liveshopping-widget-id attributeString

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.shareBaseUrl

    Overrides 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:// or https://) and query parameters.

    Default: window.location.href

    Usage example:

    widget.configure({
    channel: {
    shareBaseUrl: 'https://example.com/live-shopping?referer=joe',
    },
    });
  • configuration.channel.ui

    Hide specific elements of the Channel UI. Here are a list of available properties:

    • hideShareButton
    • hideShareList
    • hideAddToCalendarButton
    • hideAddToCalendarList

    Usage example:

    widget.configure({
    channel: {
    ui: {
    hideShareList: true,
    hideAddToCalendarList: true,
    },
    },
    });

Floating Action Button (FAB)

  • configuration.fab.redirection

    A 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.trackingTags

    A 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.

note

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',
}
]);