# Storyly Event Handling

This guide shows you how to handle Storyly events in your app. Storyly events provide insight on what is happening on a Storyly instance such as loading states, user redirections, user interaction.

Before you begin

You need to have the working Storyly integration as described in Quick Start

# Set up Delegate

StorylyView notifies application when an event occurs. You can register the listener using the following code example and then override its functions to learn about specific events, which will be explained in the next sections.

    # Basic Storyly Functionality Events

    This section shows you how to observe Storyly's basic functionality events. In order to get notification about these basic events, you should override the following function in StorylyDelegate, which you have registered in the previous section.


    # StorylyLoaded Event

    This event will let you know that Storyly has completed its network operations, and the story group list has just been shown to the user. In order to notified about this event, use the following example:

      # StorylyLoadFailed Event

      This event will let you know that Storyly has completed its network operations and had a problem while fetching your stories. In this case, users will see four empty story group icons, which we call skeleton view. In order to notified about this event, use the following example:

        # StorylyStoryPresentFailed Event

        This event will let you know that Storyly could not open Story programmatically and had a problem about parameters (Story Groupd ID, Story ID or Play Mode). In this case, users will still able to see story group icons with data. In order to notified about this event, use the following example:

          # StorylyStoryPresented Event

          This event will let you know that stories are starting to be presented to the users. In order to notified about this event, use the following example:

            # StorylyStoryDismissed Event

            This event will let you know that the user dismissed the current story while watching it. In order to notified about this event, use the following example:

              # Button Click & Swipe Up Events

              This section shows you how to handle swipe up and action button clicks from users.


              Storyly content is designed to redirect users to the application’s content more effectively. For this purpose, we’ve Call to Action flow. You can add Swipe Up or CTA Button to any story using Storyly Studio and you will have access to any information about the action with this flow. Storyly will notify your application in case of Swipe Up or CTA Button action. In order to get these notifications, you should override the following function in StorylyDelegate, which you have registered in the previous section.

                # Interactive Events with Tracking ID

                This guide shows you how to get reactions of users from specific interactive components. You can use the following function to get reactions of your users:

                  StoryComponent parameter informs your application about the interacted component and the details of the interaction. For instance, if a user answers a quiz, the payload will include what the right answer is and what the user's answer is. The structure of StoryComponent is different for each of the interactive components.

                  WARNING

                  This event only notifies your application about Emoji, Rating, Poll, Quiz, and Countdown reactions.

                  # Tracking ID

                  From Storyly Studio, application owners can give tracking ids to the interactive components. This id can be received using the customPayload field of StoryComponent.

                  # Sending Events to Analytics/Data Platforms

                  This guide shows you how to send the Storyly events to specific data platforms. You can use the following function to redirect the Storyly events to your data platform:

                    Tip

                    You can also check Storyly Events (opens new window)