Skip to main content

⚡ Custom actions

Tags: JavaScript, React, Vue, Angular, Website, Web App

We know that the built in actions (Bug Reporting, Feature Requests, Ratings & Contact Us) might not be enough for certain use cases. For these situations we offer custom actions, which allow you to start any custom action by code.

Configure a custom action​

The first step with custom actions is to open the visual widget configurator and select "Custom action" as action type.

Now you need to set a name for your custom action. Choose any name you like (it's however important that this name matches the name you check in the next step).

Setup custom actions in the Gleap dashboard.

Custom action callback​

Once you set a custom action in the Gleap dashboard, it will be called automatically on selection through the user. In order to perform custom code, simply listen for custom actions by using the registerCustomAction method.

If you use multiple custom actions, we suggest you check the triggered custom action's name in order to find out which custom action got triggered.

Gleap.registerCustomAction((customAction) => {
if (customAction.name === "MAGIC_ACTION") {
alert("It's magic!");
}
});
info

The custom action name is defined by you in the visual widget configurator.