Skip to content

Commit

Permalink
Add screenshare analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
lipis committed Aug 3, 2020
1 parent 105ca69 commit 3a69236
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/script/calling/CallingRepository.ts
Expand Up @@ -537,6 +537,21 @@ export class CallingRepository {
const selfParticipant = call.selfParticipant;
const newState = selfParticipant.sharesScreen() ? VIDEO_STATE.STOPPED : VIDEO_STATE.SCREENSHARE;
this.wCall.setVideoSendState(this.wUser, call.conversationId, newState);

if (newState === VIDEO_STATE.SCREENSHARE) {
const conversationEntity = this.conversationRepository.find_conversation_by_id(call.conversationId);
const segmentations = {
[Segmantation.CONVERSATION.TYPE]: trackingHelpers.getConversationType(conversationEntity),
[Segmantation.CONVERSATION.SIZE]: '',
[Segmantation.CONVERSATION.ALLOW_GUESTS]: '',
[Segmantation.CONVERSATION.GUESTS]: conversationEntity.hasGuest(),
[Segmantation.CONVERSATION.WIRELESS_GUESTS]: '',
[Segmantation.CONVERSATION.SERVICES]: conversationEntity.hasService(),
[Segmantation.SCREEN_SHARE.DIRECTION]: '',
[Segmantation.SCREEN_SHARE.DURATION]: '',
};
amplify.publish(WebAppEvents.ANALYTICS.EVENT, EventName.CALLING.SCREEN_SHARE, segmentations);
}
}

answerCall(call: Call, callType: number): void {
Expand Down
1 change: 1 addition & 0 deletions src/script/tracking/EventName.ts
Expand Up @@ -27,6 +27,7 @@ export const EventName = {
INITIATED_CALL: 'calling.initiated_call',
JOINED_CALL: 'calling.joined_call',
RECIEVED_CALL: 'calling.received_call',
SCREEN_SHARE: 'calling.screen_share',
},
CONTRIBUTED: 'contributed',
CONVERSATION: {
Expand Down
4 changes: 4 additions & 0 deletions src/script/tracking/Segmentation.ts
Expand Up @@ -44,4 +44,8 @@ export const Segmantation = {
IS_REPLY: 'message_is_reply',
MENTION: 'message_mention',
},
SCREEN_SHARE: {
DIRECTION: 'screen_share_direction',
DURATION: 'screen_share_duration',
},
};

0 comments on commit 3a69236

Please sign in to comment.