Custom events provide a flexible way to control section behavior in your store. This guide demonstrates how to set up and use custom events to manage section rendering based on various scenarios and conditions.Custom events enable you to:
Control section visibility based on specific triggers
In your app-embed settings, locate the “Init Event Name” section inside the app-embed and in the input field write your desired event name (e.g., initialize_app).This setting tells Glood AI which event to listen for before initializing the sections.
Here’s a simple example of how to trigger the custom event. When this event is dispatched, Glood AI will initialize all sections that are configured to listen for this event:
Copy
// This will trigger the sections to become visibledispatchEvent(new CustomEvent("initialize_app"));