User data

Event Listener

Unflow automatically tracks a number of events when a user interacts with Unflow content.

NameDescription
screen_viewedTracked the first time a screen has been shown to the user.
screen_transitionedTracked when a user swipes or taps to progress to the next page, or back to a previous page.
screen_dismissedTracked when the user closes the screen.
opener_tappedTracked when the user clicks on an opener in a space.
button_tappedTracked when a user taps a button.
rating_responseTracked when a user submits a rating.
page_appearTracked when a story page appears
page_disappearTracked when a story page disappears
question_answeredTracked when an option is selected from a question block

These events can be received on device via an AnalyticsListener. The listener can be configured to return instances of UnflowEvent to be handled within your own app.

The listener also provides you with a dictionary, or map, of the attributes we have set. If you're using flows, you'll find that sometimes the flow will set an attribute itself, so its useful to manually store this somewhere in your app too. For example, an onboarding flow may set a reason for them joining, and it would be very useful to store that yourself.

// Implement the AnalyticsListener delegate class
class UnflowAnalyticsListener: AnalyticsListener {
    func onEvent(event: UnflowEvent) {
        // Do something with the event
        print("Unflow-Analytics: \(event)")
    }
    func onAttributesUpdate(attributes: [String: UnflowUI.UnflowAnalyticsValue]) {
        // Do something with the attributes
        print("Unflow-Attributes: \(attributes)")   
    }
}

// Register the AnalyticsListener when initializing the SDK
UnflowSDK.initialize(
    config: UnflowSDK.Config(apiKey: "<YOUR_API_KEY>", enableLogging: false),
    analyticsListener: UnflowAnalyticsListener()
)

Metadata

Context is associated with each of the UnflowEvent objects received allowing for further contualation of the event. The metadata for each type is as follows.

EventKeyiOS TypeAndroid TypeNotes
screen_viewedscreen_idIntLong
page_countIntLongStories only.
screen_transitionedscreen_idIntLong
page_idIntLong
page_indexIntLongIndex of the page being transitioned to.
screen_dismissedscreen_idIntLong
page_countIntLongStories only.
pages_viewedIntLongStories only, pages viewed before the story was dismissed.
opener_tappedscreen_idIntLong
button_tappeduriStringStringThis will be the Unflow action (e.g. "unflow://action") or your custom URI.
rating_responsescreen_idIntLong
ratingIntLong
page_appearscreen_idIntLong
page_idIntLong
page_indexIntLong
total_durationDoubleLongTotal duration of the page in seconds.
page_disappearscreen_idIntLong
page_idIntLong
page_indexIntLong
total_durationDoubleLongTotal duration of the page in seconds.
remaining_durationDoubleLongRemaining duration when the page was dismissed, in seconds.
question_answeredscreen_idIntLong
block_idIntLong
selections[String]List<String>Identifiers of the selections.
selection_strings[String]List<String>Titles of the options selected ( 1.12.0 onwards )
analytics_idStringStringOptional analytics ID if provided on the dashboard.
Previous
Events