The Analytics section of the OpenWeb Android SDK allows publishers to track user interactions and behaviors. These insights help understand audience engagement, optimize content strategy, and make data-driven decisions.


OWAnalytics Interface

The OWAnalytics interface provides methods to handle analytics events and set custom data.

Properties and Methods

  • analyticAdditionalInfo: An instance of OWBIAnalyticAdditionalInfo for adding custom BI data to analytics events.
  • setAnalyticsEventDelegate(delegate: AnalyticsEventDelegate): Assigns a delegate to handle analytics events.

Default Behavior

If a delegate isn't set using setAnalyticsEventDelegate, the SDK will send analytics events to the OpenWeb Data Team by default, without notifying the publisher.


Tracking Events

Overview

The SDK enables tracking of various user actions within the app through analytics events. These events can include actions like viewing a conversation, creating comments, and more.

AnalyticsEventDelegate

The AnalyticsEventDelegate interface allows publishers to customize the handling of analytics events. Implement this interface to track events in your analytics system.

Method

fun trackEvent(
    event: OWBIAnalyticEvent,
    additionalInfo: OWBIAnalyticAdditionalInfo,
    postId: OWPostId
)

Parameters:

  • event: The analytic event being tracked.
  • additionalInfo: Additional information related to the event.
  • postId: The ID of the post associated with the event.

Example:

val analyticsDelegate = object : AnalyticsEventDelegate {
    override fun trackEvent(event: OWBIAnalyticEvent, additionalInfo: OWBIAnalyticAdditionalInfo, postId: OWPostId) {
        // Implement tracking logic here
    }
}

OpenWeb.manager.analytics.setAnalyticsEventDelegate(analyticsDelegate)

Adding Custom BI Data

Overview

Custom BI (Business Intelligence) data can be added to analytics events using the analyticAdditionalInfo property. This allows publishers to enrich event data with context-specific information.

Example:

val additionalInfo = OpenWeb.manager.analytics.analyticAdditionalInfo
additionalInfo.customBIData = mapOf(
    "userType" to "premium",
    "sessionId" to "123456"
)

OWBIAnalyticEvent Class

The OWBIAnalyticEvent class represents the analytic events tracked by the SDK. Below is a comprehensive list of available events:

Event Types

EventDescription
FullConversationLoadedTriggered when the full conversation is loaded.
PreConversationLoadedTriggered when the pre-conversation is loaded.
FullConversationViewedTriggered when the full conversation is viewed.
PreConversationViewedTriggered when the pre-conversation is viewed.
CommentMenuClickedTriggered when the comment menu is clicked.
CommentMenuClosedTriggered when the comment menu is closed.
CommentMenuReportClickedTriggered when the report option is clicked.
CommentMenuDeleteClickedTriggered when the delete option is clicked.
CommentMenuConfirmDeleteClickedTriggered when delete confirmation is clicked.
CommentMenuEditClickedTriggered when the edit option is clicked.
CommentMenuMuteClickedTriggered when the mute option is clicked.
EditCommentClickedTriggered when editing a comment is clicked.
PostCommentClickedTriggered when posting a comment.
PostReplyClickedTriggered when posting a reply.
SignUpToPostClickedTriggered when signing up to post is clicked.
CommentShareClickedTriggered when sharing a comment is clicked.
CommentReadMoreClickedTriggered when "read more" is clicked.
CommentRankUpButtonClickedTriggered when the upvote button is clicked.
CommentRankDownButtonClickedTriggered when the downvote button is clicked.
CommentRankUpUndoButtonClickedTriggered when undoing an upvote.
CommentRankDownUndoButtonClickedTriggered when undoing a downvote.
LoadMoreRepliesClickedTriggered when "load more replies" is clicked.
HideMoreRepliesClickedTriggered when "hide replies" is clicked.
SortByClickedTriggered when sorting options are clicked.
SortByClosedTriggered when sorting options are closed.
SortByChangedTriggered when sorting option changes.
UserProfileClickedTriggered when the user profile is clicked.
MyProfileClickedTriggered when "my profile" is clicked.
CreateCommentCTAClickedTriggered when creating a comment CTA is clicked.
ReplyClickedTriggered when replying to a comment is clicked.
CommentCreationClosePageTriggered when the comment creation page is closed.
CommentCreationLeavePageTriggered when leaving the comment creation page.
CommentCreationContinueWritingTriggered when continuing to write a comment.
LoginPromptClickedTriggered when the login prompt is clicked.
CommentViewedTriggered when a comment is viewed.
CameraIconClickedOpenTriggered when opening the camera icon.
CameraIconClickedTakePhotoTriggered when taking a photo via the camera.
CameraIconClickedChooseFromGalleryTriggered when choosing from the gallery.
CameraIconClickedCloseTriggered when closing the camera icon.
ShowMoreCommentsTriggered when "show more comments" is clicked.
CommunityGuidelinesLinkClickedTriggered when the community guidelines link is clicked.
ReportMessageSubmitSuccessTriggered when a report message submission is successful.
SuperReportMessageSubmitSuccessTriggered when a super report submission is successful.