Analytics
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
Event | Description |
---|---|
FullConversationLoaded | Triggered when the full conversation is loaded. |
PreConversationLoaded | Triggered when the pre-conversation is loaded. |
FullConversationViewed | Triggered when the full conversation is viewed. |
PreConversationViewed | Triggered when the pre-conversation is viewed. |
CommentMenuClicked | Triggered when the comment menu is clicked. |
CommentMenuClosed | Triggered when the comment menu is closed. |
CommentMenuReportClicked | Triggered when the report option is clicked. |
CommentMenuDeleteClicked | Triggered when the delete option is clicked. |
CommentMenuConfirmDeleteClicked | Triggered when delete confirmation is clicked. |
CommentMenuEditClicked | Triggered when the edit option is clicked. |
CommentMenuMuteClicked | Triggered when the mute option is clicked. |
EditCommentClicked | Triggered when editing a comment is clicked. |
PostCommentClicked | Triggered when posting a comment. |
PostReplyClicked | Triggered when posting a reply. |
SignUpToPostClicked | Triggered when signing up to post is clicked. |
CommentShareClicked | Triggered when sharing a comment is clicked. |
CommentReadMoreClicked | Triggered when "read more" is clicked. |
CommentRankUpButtonClicked | Triggered when the upvote button is clicked. |
CommentRankDownButtonClicked | Triggered when the downvote button is clicked. |
CommentRankUpUndoButtonClicked | Triggered when undoing an upvote. |
CommentRankDownUndoButtonClicked | Triggered when undoing a downvote. |
LoadMoreRepliesClicked | Triggered when "load more replies" is clicked. |
HideMoreRepliesClicked | Triggered when "hide replies" is clicked. |
SortByClicked | Triggered when sorting options are clicked. |
SortByClosed | Triggered when sorting options are closed. |
SortByChanged | Triggered when sorting option changes. |
UserProfileClicked | Triggered when the user profile is clicked. |
MyProfileClicked | Triggered when "my profile" is clicked. |
CreateCommentCTAClicked | Triggered when creating a comment CTA is clicked. |
ReplyClicked | Triggered when replying to a comment is clicked. |
CommentCreationClosePage | Triggered when the comment creation page is closed. |
CommentCreationLeavePage | Triggered when leaving the comment creation page. |
CommentCreationContinueWriting | Triggered when continuing to write a comment. |
LoginPromptClicked | Triggered when the login prompt is clicked. |
CommentViewed | Triggered when a comment is viewed. |
CameraIconClickedOpen | Triggered when opening the camera icon. |
CameraIconClickedTakePhoto | Triggered when taking a photo via the camera. |
CameraIconClickedChooseFromGallery | Triggered when choosing from the gallery. |
CameraIconClickedClose | Triggered when closing the camera icon. |
ShowMoreComments | Triggered when "show more comments" is clicked. |
CommunityGuidelinesLinkClicked | Triggered when the community guidelines link is clicked. |
ReportMessageSubmitSuccess | Triggered when a report message submission is successful. |
SuperReportMessageSubmitSuccess | Triggered when a super report submission is successful. |
Updated 1 day ago