Button

A button widget that can be used for navigating stories, as a link, or for implementing a custom scenario within your application.

Actions

Custom action

To add custom action select "Custom" in the "Link&action" dropdown menu.

Web

To use a custom action in the WebSDK, provide the necessary information in the Web field. For example, you can enter details such as the navigation path or screen name. Then, handle the button click event to capture this data.

To handle the event, get a container with the following HTML selector -#storysdk:

const container = document.querySelector('#storysdk');

Add event listener to listen 'storysdk_custom_click' event:

container.addEventListener('storysdk_custom_click', (event) => {
    console.log('my custom data', event.detail.data);
    // Wtrite your code here
});

To retrieve the data you entered, use the event.detail.data field inside the event listener.

Last updated

Was this helpful?