Client API
Events

Events Method

What is the Events method?

The Events Method is a way to track events and trigger specific surveys based on actions or behaviors from your users.

💡

Pro tip. While you can show and hide surveys programmatically with the Show and Hide methods, triggering surveys by the Events API is best practice because it allows your non-technical to swap out and edit certain surveys to show for different events. This can be configured in the trigger and target options for each survey.

How to use the Events method

In the most simple example, you decide you want to trigger and show a specific survey when a user clicks a button.

If you set your survey to trigger via the button_click event inside your survey's settings, you can then call this survey like this:

<button
  onclick="{()=> {
        window.lb('event', {
            event: 'button_click'
        });
    }}"
>
  Click me to trigger a survey with the button_click event!
</button>