---
title: "Ionic Capacitor SDK: Custom actions"
description: "Handle custom actions triggered by the widget with the Gleap Ionic Capacitor SDK. Follow the integration code examples."
url: https://docs.gleap.ai/en/articles/574-ionic-capacitor-sdk-custom-actions
collection: "Ionic / Capacitor"
updated: 2026-11-01
language: en
---

# Ionic Capacitor SDK: Custom actions

Handle custom actions triggered by the widget with the Gleap Ionic Capacitor SDK. Follow the integration code examples.

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

Open Settings → Widget → Content → Quick actions. Add or open a quick action, choose Custom action, and enter its Custom action name. Use that exact name in the handler below.

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

![Current messenger quick-action settings in the Pied Piper demo project.](https://staticfiles.gleap.io/p613b5dd730aed737108f87ab/gmAdnE7X2jnNhNn1dRmzvgLczFyPAIF7Qsn2PicWuQHx4eAMN1Er2Il0dBP2VBl1brGt4Zn56QT.png)

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

```javascript
Gleap.setEventCallback((message, err) => {
  const { name, data } = message;

  if (name === "custom-action-called") {
    console.log(data);
  }
});
```

> **Info:** The **custom action name** is defined by you in the visual widget configurator.

## Related

- [Ionic Capacitor SDK setup](https://docs.gleap.ai/en/articles/563-ionic-capacitor-sdk-setup.md)
- [Ionic Capacitor SDK: User identity](https://docs.gleap.ai/en/articles/564-ionic-capacitor-sdk-user-identity.md)
- [Ionic Capacitor SDK: Frontend tools](https://docs.gleap.ai/en/articles/565-ionic-capacitor-sdk-frontend-tools.md)
- [Ionic Capacitor SDK: Track events](https://docs.gleap.ai/en/articles/566-ionic-capacitor-sdk-track-events.md)
- [Ionic Capacitor SDK: Track pages](https://docs.gleap.ai/en/articles/567-ionic-capacitor-sdk-track-pages.md)
