diff --git a/src/kava-event-model.js b/src/kava-event-model.js index b6305776..3035eb02 100644 --- a/src/kava-event-model.js +++ b/src/kava-event-model.js @@ -145,6 +145,9 @@ export function getEventModel(eventObj: KavaEvent, model: KavaModel): Object { if (model.getUIConfId()) { commonModel.uiConfId = model.getUIConfId(); } + if (model.getPlaylistId()) { + commonModel.playlistId = model.getPlaylistId(); + } if (model.getCustomVar1()) { commonModel.customVar1 = model.getCustomVar1(); } diff --git a/src/kava-model.js b/src/kava-model.js index be7a7b9c..e2992b94 100644 --- a/src/kava-model.js +++ b/src/kava-model.js @@ -21,6 +21,7 @@ class KavaModel { getAverageBitrate: Function; getPartnerId: Function; getEntryId: Function; + getPlaylistId: Function; getSessionId: Function; getClientVer: Function; getClientTag: Function; diff --git a/src/kava.js b/src/kava.js index 575edd67..30b0e736 100644 --- a/src/kava.js +++ b/src/kava.js @@ -362,6 +362,7 @@ class Kava extends BasePlugin { this._model.getAverageBitrate = () => this._rateHandler.getAverage(); this._model.getPartnerId = () => this.config.partnerId; this._model.getEntryId = () => this.config.entryId; + this._model.getPlaylistId = () => this.config.playlistId; this._model.getSessionId = () => this.config.sessionId; this._model.getClientVer = () => this.config.playerVersion; this._model.getClientTag = () => 'html5:v' + this.config.playerVersion; @@ -413,22 +414,22 @@ class Kava extends BasePlugin { _validate(): boolean { if (!this.config.partnerId) { - Kava._logMissingParam('partnerId'); + this._logMissingParam('partnerId'); return false; } if (!this.config.entryId) { - Kava._logMissingParam('entryId'); + this._logMissingParam('entryId'); return false; } return true; } - static _getTimeDifferenceInSeconds(time): number { - return (Date.now() - time) / 1000.0; + _logMissingParam(missingParam: string): void { + this.logger.warn(`Kava analytics block report because of missing param ${missingParam}`); } - static _logMissingParam(missingParam: string): void { - this.logger.warn(`Kava analytics block report because of missing param ${missingParam}`); + static _getTimeDifferenceInSeconds(time): number { + return (Date.now() - time) / 1000.0; } } diff --git a/test/src/kava-model.spec.js b/test/src/kava-model.spec.js index 3fc03f4b..eff53d0c 100644 --- a/test/src/kava-model.spec.js +++ b/test/src/kava-model.spec.js @@ -4,6 +4,7 @@ const ab = 3, avb = 5, pid = 'partner', eid = 'entry', + plid = 'playlist', sid = 'session', referrer = 'http://referrer', cv = 'version', @@ -62,6 +63,7 @@ describe('KavaModel', () => { model.getAverageBitrate = () => avb; model.getPartnerId = () => pid; model.getEntryId = () => eid; + model.getPlaylistId = () => plid; model.getSessionId = () => sid; model.getReferrer = () => referrer; model.getClientVer = () => cv; @@ -95,6 +97,7 @@ describe('KavaModel', () => { eventType: eventModel.MY_EVENT.index, partnerId: pid, entryId: eid, + playlistId: plid, sessionId: sid, eventIndex: ei, referrer: referrer, diff --git a/test/src/kava.spec.js b/test/src/kava.spec.js index 2a854674..7aa058fe 100644 --- a/test/src/kava.spec.js +++ b/test/src/kava.spec.js @@ -104,6 +104,7 @@ describe('KavaPlugin', function() { playerName: 'kaltura-player-js', partnerId: '1091', entryId: '0_wifqaipd', + playlistId: '12345678', entryType: 'Vod', sessionId: 'c15be273-0f1b-10a3-4fc9-d7a53eebee85:b66abd37-e2e2-a22e-86ac-7859592e754b', ks: 'Njk0ZmI4MzBiOTJiMGZhN2NmNTAwYWQyZGM2M2Y0YjkxMGRiZGI3MXwxMDkxOzEwOTE7MTUxNzkyMjgxMzswOzE1MTc4MzY0MTMuMTM4OzA7dmlldzoqLHdpZGdldDoxOzs=' @@ -136,6 +137,7 @@ describe('KavaPlugin', function() { params.eventType.should.equal(eventIndex); params.partnerId.should.equal(config.session.partnerId.toString()); params.entryId.should.equal(config.id); + params.playlistId.should.equal(config.plugins.kava.playlistId); params.sessionId.should.equal(config.session.id); params.eventIndex.should.equal(1); params.ks.should.equal(config.session.ks);