> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.poool.fr/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Custom Buttons: Trigger your actions using the customButtonClick event.

# How does it work?

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

[![](https://storage.crisp.chat/users/helpdesk/website/-/6/2/3/5/623583b8499ffc0/4724c80b-49d8-417e-88c2-78623a_1esg3vk.png)](https://downloads.intercomcdn.com/i/o/1079264216/059130b0eada9571f14dc35c/custombutton.png?expires=1773333900&signature=1f459366863077cc2ae2f6f59e237b71bc2234c6d35fd491576982aaf9c56902&req=dSAgH8t4mYNeX%2FMW1HO4zV3jhqP897Fuz4DGKpjqzqLrP7H5oUnEBTI030fe%0A517pq7mWM4Hc8fvKE%2Bk%3D%0A)

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](https://help.poool.fr/en/articles/7038469-how-do-i-activate-the-subscribe-with-google-option-in-my-paywall)).

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:

[![](https://storage.crisp.chat/users/helpdesk/website/-/2/9/5/d/295daae20b334e00/aec04bec-e4d6-4908-a80a-5b314a_1mot3g0.png)](https://downloads.intercomcdn.com/i/o/1079269592/d144821e48a78273e5fdc4eb/customButton1.png?expires=1773333900&signature=fff4595315e1c72ee3749a85ab7a83d9a956635ba250c72c996bba1988e6ccc2&req=dSAgH8t4lIRWW%2FMW1HO4zRDnSUjP%2FVEzpWR0eE0n4PGpuFrPxwb%2B4zJh3T5U%0ADNQ2jFCzVBgfO3iBm3E%3D%0A)

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](https://www.poool.dev/docs/access/javascript/access/events#custombuttonclick).
