Custom triggers

Triggers are used in the widget flow to decide if we would like to hide the widget for the user or not.
For example, we want the subscription widget to disepear for a week when a user successfully subscribed.

You can see how triggers used in widget flow

Create custom trigger

To create a custom trigger we need to use fouita utility function

 // needed for fouita to detect the widget
 export let __service 
 function trigger(action) {, action)

<button class="bg-tertiary/75 p-2 text-white" on:click={() => trigger('Clicked')}>   
  Click to call trigger

Once we have our trigger call we need to add its name to list of triggers, this is for the widget flow to recognize it.

Click on "Set Triggers"

Triggers UI will appear, we need to click on the "+" button and add the trigger name that we used in the code to launch the trigger (case sensitive)

fouita trigger

We save it and save our widget.

Note: the Set Trigger button on the editor will be displayed only if we edit a widget, if it's a new widget we need to save it first, then edit it again
fouita trigger

Now when we click on the flow icon from widget control bar, we will notice the trigger "Clicked" in the action section of the flow.
The missing pieces of your website.
kairouan, tunisia
built using fouita!