Sending Events

This section shows you how to send the JOIN Stories events to specific data platforms. You can use the following function of JOINStoriesAnalyticsListener to redirect the JOIN Stories events to your data platform :

val analyticsListener: JOINStoriesAnalyticsListener = object : JOINStoriesAnalyticsListener {
  override fun onTriggerAnalyticsCallback(event: JOINStoriesTriggerEventType, data: JOINAnalyticsTrigger) {}
  override fun onPlayerAnalyticsCallback(event: JOINStoriesPlayerEventType, data: JOINAnalyticsPlayer) {}
}
...
trigger.joinAnalyticsListener = analyticsListener
// OR
JOINStories.startPlayer(context, "<you_join_alias>", analyticsListener)

🚧

Analytics sender

When integrating, you need to be aware of the widget's lifecycle, as the widget may send events several times during use if it is destroyed and recreated, in the case of a dynamic list (RecyclerView, for example).

JOIN Stories Events

In order to get notification about JOIN Stories events, you should override the following functions in JOINStoriesAnalyticsListener. The events are separated between trigger events (onTriggerAnalyticsCallback called) and player events (onPlayerAnalyticsCallback called).

Trigger Events

onTriggerAnalyticsCallback returns the following payload for each event:

data class JOINAnalyticsTrigger(
    val eventOwner: String, // owner of the story (equal teamId)
    val cpWidgetAlias: String, // Alias of the trigger
    val cpWidgetVersion: String, // Version of the SDK
    val date: Long, // Current UNIX Timestamp in ms
    val eventCategory: String = "widget",
    val eventTypeName: String, // The event type name
    var eventType: JOINStoriesTriggerEventType?, // The event type
    val storyClicked: String? // The story id - only for click events
)

Stories Fetched Event

Each time the trigger fetch the list of stories from the API, a Stories fetched event is sent:

event: JOINStoriesTriggerEventType.StoriesFetched

Trigger Mounted Event

Each time the trigger is instantiated, a Trigger Mounted event is sent:

event: JOINStoriesTriggerEventType.WidgetMounted

Trigger Visibility 50% Event

After instantiation, the first time the trigger is visible at least on 50% of its height, a Trigger Visible 50% event is sent:

event: JOINStoriesTriggerEventType.ComponentVisible50

Trigger Visibility 75% Event

After instantiation, the first time the trigger is visible at least on 75% of its height, a Trigger Visible 75% event is sent:

event: JOINStoriesTriggerEventType.ComponentVisible75

First Click on Trigger Event

After instantiation, the first time the trigger is clicked to open the player, a First Click on Trigger event is sent:

event: JOINStoriesTriggerEventType.FirstClickOnWidget

It also contains the following value: storyClicked: STORY_ID

Additional Click on Trigger

Each time the trigger is clicked after the first click (see previous event), an Additional Click on Trigger event is sent:

event: JOINStoriesTriggerEventType.AdditionalClickOnWidget

It also contains the following value: storyClicked: STORY_ID

Player Events

onPlayerAnalyticsCallback returns the following payload for each event:

data class JOINAnalyticsPlayer(
    val storyPageCount: Int, // Number of chapter of the story
    val eventOwner: String, // owner of the story (equal teamId)
    val storyId: String, // ID of the story
    val date: Long, // Current UNIX Timestamp in ms
    val eventCategory: String = "story",
    val cpIndex: Int, // Index of the current chapter: from 0 to N
    val cpTitle: String, // Title of the story
    var eventType: JOINStoriesPlayerEventType?, // The event type
    val eventTypeName: String // The event type name
)

Chapter View Event

Each time a chapter (equivalent to story page) starts playing, a Chapter View event is sent:

event: JOINStoriesPlayerEventType.StoryPageVisible

Last Chapter View Event

Each time the last chapter (last story page) starts playing, a Last Chapter View event is sent:

event: JOINStoriesPlayerEventType.StoryLastPageVisible

Click Call To Action Event

Each time the user clicks on a CTA, a Click Call To Action event is sent:

event: JOINStoriesPlayerEventType.StoryClickOnCallToAction