Skip to main content
All CollectionsAppearancesAdvanced appearances
Custom Buttons: Trigger your actions using the customButtonClick event.
Custom Buttons: Trigger your actions using the customButtonClick event.

Your custom buttons allow you to trigger actions of your choice using the customButtonClick JS event.

M
Written by Marc-Antoine Begin
Updated over a week ago

How does it work?

When you create your button in an advanced appearance, if you choose to trigger an event like this:

The customButtonClick event is triggered when this button is clicked.

So you can use it to trigger the action of your choice. This could be displaying a modal or subscribing with Google (as described in this article).

The code looks like this:

access.on('customButtonClick', () => {
{ /* trigger you event */ }
}
)

Do I have to give a name to the event I want to trigger?

No, this is not mandatory.

Poool gives you the option of specifying the event name in the button options here:

However, this is optional, as it is the customButtonClick event that is triggered. Naming your event may allow you to differentiate between two custom buttons on the same appearance.

The code looks like this:

access.on('customButtonClick', e => {
if (e.name === 'my_event_name')
{ /* trigger your event */ }
}
)

You can find information about the JS customButtonClick event in our technical documentation 👉 here.

Any doubts or questions? Don't hesitate to contact us via our chat!

Did this answer your question?