Track Analytics Events

Learn how to track analytics events in your Android app.

The AnalyticsEventDelegate allows you to track analytics events.



Track events

Use the following steps to track analytics events:

  1. Set an AnalyticsEventDelegate.
SpotIm.setAnalyticsEventDelegate(object : AnalyticsEventDelegate {
    override fun trackEvent(type: AnalyticsEventType, event: Event) {
        when (type) {
            AnalyticsEventType.USER_PROFILE_CLICKED -> Log.d("Spot.IM Analytics Event", event.type)
            // More types can be handled here.
        }
    }
})

  1. Add more events in the switch sentence, according to your requirements.


AnalyticsEventType Reference

AnalyticsEventType Event Action
ADD_DISPLAY_NAME_CLICKED add-display-name-clicked User clicked on a post after inserting a display name.
ADD_DISPLAY_NAME_CLOSED add-display-name-closed Display name pop-up has been closed.
ADD_DISPLAY_NAME_VIEWED add-display-name-viewed When commenting as a guest, the display name pop-up has been opened.
APP_CLOSED app-closed App has moved to the background.
APP_INITIALIZED app-initialized SDK has been initialized.
APP_OPENED app-opened App has moved to the foreground.
BACK_CLICKED back-clicked User pressed the back button.
COMMENT_DELETE_CLICKED comment-delete-clicked User clicked Delete in the comment's context menu.
COMMENT_MUTE_CLICKED comment-mute-clicked User muted
COMMENT_POST_CLICKED comment-post-clicked User clicked the Post button in the create comment screen.
COMMENT_RANK_DOWN_CLICKED comment-rank-down-button-clicked User clicked on the rank-down button.
COMMENT_RANK_DOWN_UNDO comment-rank-down-button-undo User clicked on the selected rank-down button to undo ranking down a comment.
COMMENT_RANK_UP_CLICKED comment-rank-up-button-clicked User clicked on the rank-up button.
COMMENT_RANK_UP_UNDO comment-rank-up-button-undo User clicked on the selected rank-up button to undo ranking up a comment.
COMMENT_READ_LESS_CLICKED comment-read-less-clicked User clicked the Read Less button in a long message.
COMMENT_READ_MORE_CLICKED comment-read-more-clicked User clicked the Read More button in a long message.
COMMENT_REPORT_CLICKED comment-report-clicked User clicked Report in the comment's context menu.
COMMENT_SHARE_CLICKED comment-share-clicked User clicked Share in the comment's context menu.
COMMUNITY_GUIDELINES_LINK_CLICKED community-guidelines-link-clicked User clicked a link in the community guidelines.
CREATE_MESSAGE_CLICKED create-message-clicked User opened the create comment screen.
ENGINE_STATUS engine_status Monetization events.
HIDE_MORE_REPLIES_CLICKED hide-more-replies-clicked User clicked the Show Less Comments button.
LOAD_MORE_REPLIES_CLICKED load-more-replies-clicked User clicked the Show More Comments button.
LOADED loaded Conversation loaded on the screen.
LOGIN_CLICKED login-clicked User clicked on the login button.
MAIN_VIEWED main-viewed Full Conversation is initially viewed by the user.
MESSAGE_CONTEXT_MENU_CLICKED message-context-menu-clicked User clicked to open the comment's context menu.
MESSAGE_CONTEXT_MENU_CLOSED message-context-menu-closed User closed the comment's context menu.
MY_PROFILE_CLICKED my-profile-clicked User clicked on his or her own profile button.

This event returns the following extra data:
  • targetType: Indicates if profile-avatar or profile-user-name was clicked
READING reading Pre-Conversation has been closed.
REGISTRATION_SCREEN_CLICKED registration-screen-clicked User clicked the social connect button on the login screen.
REGISTRATION_SCREEN_CLOSED registration-screen-closed Login screen has been closed.
REGISTRATION_SCREEN_FAILURE registration-screen-failure User's social connect login attempt has failed.
REGISTRATION_SCREEN_SUCCESS registration-screen-success User logged in successfully through social connect.
REGISTRATION_SCREEN_VIEWED registration-screen-viewed User opened the login screen.
SORT_BY_CLICKED sort-by-clicked User changed the sorting of the Conversation.
SORT_BY_OPENED sort-by-opened User clicked on the sort drop-down.
USER_PROFILE_CLICKED user-profile-clicked User clicked on the profile button of a specific user.

This event returns the following extra data:
  • targetType: Indicates if profile-avatar or profile-user-name was clicked
VIEWED viewed Conversation is initially viewed by the user.