diff --git a/src/application-events-model.ts b/src/application-events-model.ts index c1edeee2..ec7e5d94 100644 --- a/src/application-events-model.ts +++ b/src/application-events-model.ts @@ -3,18 +3,24 @@ import { KavaEvent } from './types'; import { ButtonType } from './enums/button-type'; import { ApplicationEventType } from './enums/application-event-type'; import { PageLoadType } from './enums/page-load-type'; -import { PluginsEvents } from './applications-events'; +import { PlaykitUIEvents, PluginsEvents } from './applications-events'; export function getApplicationEventsModel(eventObj: KavaEvent, model: KavaModel, innerEventPayload: any): any { const commonModel = { partnerId: model.getPartnerId(), entryId: model.getEntryId(), sessionId: model.getSessionId(), - kalturaApplication: model.getKalturaApplication() + kalturaApplication: model.getKalturaApplication(), + kalturaApplicationVer: model.getKalturaApplicationVersion(), + application: model.getApplication(), + applicationVer: model.getApplicationVersion(), + virtualEventId: model.getVirtualEventId() }; + if (model.getUserId()) { commonModel['userId'] = model.getUserId(); } + const eventModel = eventObj.getEventModel(innerEventPayload); return Object.assign(eventModel, commonModel); } @@ -25,7 +31,7 @@ export const ApplicationEventsModel: { [playerEventName: string]: KavaEvent } = getEventModel: (payload: any): any => ({ eventType: ApplicationEventType.BUTTON_CLICKED, buttonName: 'Dual__screen_change_layout', - buttonType: ButtonType.Unknown, + buttonType: ButtonType.Choose, buttonValue: payload.layout }) }, @@ -356,22 +362,22 @@ export const ApplicationEventsModel: { [playerEventName: string]: KavaEvent } = type: 'RELATED_OPEN', getEventModel: (payload: any): any => ({ eventType: ApplicationEventType.BUTTON_CLICKED, - buttonName: 'Related_open', + buttonName: 'Related_open_manual', buttonType: ButtonType.Open, buttonValue: payload['expandMode'] }) }, [PluginsEvents.RELATED_CLOSE]: { type: 'RELATED_CLOSE', - getEventModel: (payload: any): any => ({ + getEventModel: (): any => ({ eventType: ApplicationEventType.BUTTON_CLICKED, buttonName: 'Related_close', buttonType: ButtonType.Close, - buttonValue: payload['expandMode'] + buttonValue: '' }) }, - [PluginsEvents.RELATED_SELECTED]: { - type: 'RELATED_SELECTED', + [PluginsEvents.RELATED_ENTRY_SELECTED]: { + type: 'RELATED_ENTRY_SELECTED', getEventModel: (): any => ({ eventType: ApplicationEventType.BUTTON_CLICKED, buttonName: 'Related_entry_click', @@ -379,6 +385,24 @@ export const ApplicationEventsModel: { [playerEventName: string]: KavaEvent } = buttonValue: '' }) }, + [PluginsEvents.RELATED_ENTRY_AUTO_PLAYED]: { + type: 'RELATED_ENTRY_AUTO_PLAYED', + getEventModel: (): any => ({ + eventType: ApplicationEventType.PAGE_LOAD, + buttonName: 'Related_entry_auto_continue', + buttonType: PageLoadType.View, + buttonValue: '' + }) + }, + [PluginsEvents.RELATED_GRID_DISPLAYED]: { + type: 'RELATED_GRID_DISPLAYED', + getEventModel: (): any => ({ + eventType: ApplicationEventType.PAGE_LOAD, + buttonName: 'Related_open_auto', + buttonType: PageLoadType.View, + buttonValue: '' + }) + }, [PluginsEvents.CALL_TO_ACTION_BUTTON_CLICK]: { type: 'CALL_TO_ACTION_BUTTON_CLICK', getEventModel: (payload: any): any => ({ @@ -387,5 +411,68 @@ export const ApplicationEventsModel: { [playerEventName: string]: KavaEvent } = buttonType: ButtonType.Link, buttonName: payload['type'] === 'primary' ? 'CTA_primary_button_click' : 'CTA_secondary_button_click' }) + }, + [PluginsEvents.HOTSPOT_DISPLAYED]: { + type: 'HOTSPOT_DISPLAYED', + getEventModel: (payload: any): any => ({ + eventType: ApplicationEventType.PAGE_LOAD, + buttonName: 'Hotspot_displayed', + buttonType: PageLoadType.View, + buttonValue: payload['label'] + }) + }, + [PluginsEvents.HOTSPOT_CLICK]: { + type: 'HOTSPOT_CLICK', + getEventModel: (payload: any): any => ({ + eventType: ApplicationEventType.BUTTON_CLICKED, + buttonName: 'Hotspot_click', + buttonType: ButtonType.Link, + buttonValue: payload['label'] + }) + }, + [PluginsEvents.QUIZ_STARTED]: { + type: 'QUIZ_STARTED', + getEventModel: (): any => ({ + eventType: ApplicationEventType.BUTTON_CLICKED, + buttonName: 'Quiz_start', + buttonType: ButtonType.Load, + buttonValue: '' + }) + }, + [PluginsEvents.QUIZ_SUBMITTED]: { + type: 'QUIZ_SUBMITTED', + getEventModel: (): any => ({ + eventType: ApplicationEventType.BUTTON_CLICKED, + buttonName: 'Quiz_submit', + buttonType: ButtonType.Send, + buttonValue: '' + }) + }, + [PluginsEvents.QUIZ_SKIPPED]: { + type: 'QUIZ_SKIPPED', + getEventModel: (payload: any): any => ({ + eventType: ApplicationEventType.BUTTON_CLICKED, + buttonName: 'Quiz_skip_question', + buttonType: ButtonType.Navigate, + buttonValue: payload['id'] + }) + }, + [PluginsEvents.QUIZ_SEEK]: { + type: 'QUIZ_SEEK', + getEventModel: (): any => ({ + eventType: ApplicationEventType.BUTTON_CLICKED, + buttonName: 'Quiz_nav_click', + buttonType: ButtonType.Navigate, + buttonValue: '' + }) + }, + [PlaykitUIEvents.USER_CLICKED_LOGO]: { + type: 'USER_CLICKED_LOGO', + getEventModel: (payload: any): any => ({ + eventType: ApplicationEventType.BUTTON_CLICKED, + buttonName: 'Logo_click', + buttonType: ButtonType.Link, + buttonValue: payload['logoUrl'] + }) } }; diff --git a/src/applications-events.ts b/src/applications-events.ts index b029e9be..1eb50d60 100644 --- a/src/applications-events.ts +++ b/src/applications-events.ts @@ -1,3 +1,7 @@ +export const PlaykitUIEvents = { + USER_CLICKED_LOGO: 'playkit-ui-userclickedlogo' +}; + export const NavigationEvents = { NAVIGATION_OPEN: 'navigation_open', NAVIGATION_CLOSE: 'navigation_close', @@ -44,15 +48,32 @@ export const PlaylistEvents = { }; export const RelatedEvents = { - RELATED_SELECTED: 'related_selected', RELATED_OPEN: 'related_open', - RELATED_CLOSE: 'related_close' + RELATED_CLOSE: 'related_close', + RELATED_ENTRY_SELECTED: 'related_entry_selected', + RELATED_ENTRY_AUTO_PLAYED: 'related_entry_auto_played', + RELATED_GRID_DISPLAYED: 'related_grid_displayed' }; export const CallToActionEvents = { CALL_TO_ACTION_BUTTON_CLICK: 'call_to_action_button_click' }; +export const HotspotsEvents = { + HOTSPOT_CLICK: 'hotspot_click', + HOTSPOT_DISPLAYED: 'hotspot_displayed' +}; + +export const IvqEventTypes = { + QUIZ_STARTED: 'QuizStarted', + QUIZ_SKIPPED: 'QuizSkipped', + QUIZ_SEEK: 'QuizSeek', + QUESTION_ANSWERED: 'QuestionAnswered', + QUIZ_SUBMITTED: 'QuizSubmitted', + QUIZ_RETAKE: 'QuizRetake', + QUIZ_QUESTION_CHANGED: 'QuizQuestionChanged' +}; + export const PluginsEvents = { ...NavigationEvents, ...DownloadEvents, @@ -63,5 +84,7 @@ export const PluginsEvents = { ...SkipEvents, ...PlaylistEvents, ...RelatedEvents, - ...CallToActionEvents + ...CallToActionEvents, + ...HotspotsEvents, + ...IvqEventTypes }; diff --git a/src/enums/button-type.ts b/src/enums/button-type.ts index 13daf85b..e7b327c3 100644 --- a/src/enums/button-type.ts +++ b/src/enums/button-type.ts @@ -29,6 +29,5 @@ export enum ButtonType { Toggle = 26, Thumbnail = 27, Download = 28, - Share = 29, - Unknown = 'Unknown' + Share = 29 }