Track Analytics Event

The SDK supports tracking analytics events using SPAnalyticsEventDelegate.

In order to track the events sending from the SDK, you have to implement the SPAnalyticsEventDelegate protocol as follows:

extension ViewController: SPAnalyticsEventDelegate {
    internal func trackEvent(type: SPAnalyticsEventType, event: SPAnalyticsEventInfo) {
        switch type {
        case .userProfileClicked:
            print("Spot.IM Analytics Event - " + event.eventType)
        // more types can be handled here ...
        default:
            print("Spot.IM Analytics Event - " + event.eventType)
        }
    }
}

Set self as SPAnalyticsEventDelegate:

SpotIm.setAnalyticsEventDelegate(delegate: self)

Events

SPAnalyticsEventType

Event

Description

loaded

loaded

The Conversation is loaded on the screen.

viewed

viewed

The Conversation is initially viewed by the user.

mainViewed

main-viewed

Full Conversation is initially viewed by the user.

messageContextMenuClicked

message-context-menu-clicked

The user has clicked to open the comment's context menu.

messageContextMenuClosed

message-context-menu-closed

The user has closed the comment's context menu.

userProfileClicked

user-profile-clicked

The user has clicked on the Profile button of a specific user.
Extra data:
targetType: profile-avatar/profile-user-name

myProfileClicked

my-profile-clicked

The user has clicked on his Profile button.
Extra data:
targetType: profile-avatar/profile-user-name

loginClicked

login-clicked

The user has clicked on login button.

reading

reading

Fired when the pre-conversation is closed.

loadMoreRepliesClicked

load-more-replies-clicked

The user has clicked on the "Show More Comments" button.

hideMoreRepliesClicked

hide-more-replies-clicked

The user has clicked on the "Show Less Comments" button.

commentReadMoreClicked

comment-read-more-clicked

The user has clicked on "read more" button on a long message.

commentReadLessClicked

comment-read-less-clicked

The user has clicked on "read less" button on a long message.

appInit

app-initialized

The SDK has been initialized.

appOpened

app-opened

The app has moved to the foreground.

appClosed

app-closed

The app has moved to the background.

sortByOpened

sort-by-opened

The user has clicked on the sort drop-down.

sortByClicked

sort-by-clicked

The user has changed the sorting of the conversation.

createMessageClicked

create-message-clicked

The user has opened the create comment screen.

loadMoreComments

load-more-comments-clicked

More comment are loaded (by tapping "show more comments" in pre-conversation, or by scrolling in full-conversation)

engineStatus

engine_status

Monetization events.

communityGuidelinesLinkClicked

community-guidelines-link-clicked

The user has clicked a link in the community guidelines.

commentShareClicked

comment-share-clicked

The user has clicked share on the comment's context menu.

CommentReportClicked

comment-report-clicked

The user has clicked report on the comment's context menu.

CommentDeleteClicked

comment-delete-clicked

The user has clicked delete on the comment's context menu.

commentPostClicked

comment-post-clicked

The user clicked the post button in create comment screen.

commentRankUpButtonClicked

comment-rank-up-button-clicked

The user clicked on the rank-up button.

commentRankUpButtonUndo

comment-rank-up-button-undo

The user clicked on selected rank-up button (undo).

commentRankDownButtonClicked

comment-rank-down-button-clicked

The user clicked on the rank-down button.

commentRankDownButtonUndo

comment-rank-down-button-undo

The user clicked on selected rank-down button (undo).


Did this page help you?