Skip to content

Commit

Permalink
feat(FEC-11748): adding player events for EP analytics (#109)
Browse files Browse the repository at this point in the history
add `virtualEventId` to kava beacons
  • Loading branch information
yairans authored Dec 12, 2021
1 parent dc6d0eb commit e9bf239
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/kava-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ Kava parameters are additional data that is sent with Kava event and represent r

---

<a id="virtualEventId"></a>`virtualEventId` - The Kaltura virtual event id.

- Obtained from the plugin config.
- If not exist do not send this parameter at all.

---

<a id="eventIndex"></a>`eventIndex` - A sequence number which describe the order of events in a viewing session. In general it is just a counter of sent events.

- Starts from 1.
Expand Down Expand Up @@ -330,6 +337,7 @@ The common parameters defined the following:
- [`sessionId`](#sessionId)
- [`eventIndex`](#eventIndex)
- [`ks`](#ks)
- [`virtualEventId`](#virtualEventId)
- [`referrer`](#referrer)
- [`deliveryType`](#deliveryType)
- [`playbackType`](#playbackType)
Expand Down
3 changes: 3 additions & 0 deletions src/kava-event-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ export function getEventModel(eventObj: KavaEvent, model: KavaModel): Object {
if (model.getKS()) {
commonModel.ks = model.getKS();
}
if (model.getVirtualEventId()) {
commonModel.virtualEventId = model.getVirtualEventId();
}
if (model.getUIConfId()) {
commonModel.uiConfId = model.getUIConfId();
}
Expand Down
1 change: 1 addition & 0 deletions src/kava-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class KavaModel {
getClientVer: Function;
getClientTag: Function;
getKS: Function;
getVirtualEventId: Function;
getUIConfId: Function;
getReferrer: Function;
getCustomVar1: Function;
Expand Down
1 change: 1 addition & 0 deletions src/kava.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ class Kava extends BasePlugin {
this._model.getClientVer = () => this.config.playerVersion;
this._model.getClientTag = () => 'html5:v' + this.config.playerVersion;
this._model.getKS = () => this.config.ks;
this._model.getVirtualEventId = () => this.config.virtualEventId;
this._model.getUIConfId = () => this.config.uiConfId;
this._model.getReferrer = () => this.config.referrer;
this._model.getCustomVar1 = () => this.config.customVar1;
Expand Down
3 changes: 3 additions & 0 deletions test/src/kava-model.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ab = 3,
cv = 'version',
ct = 'html5:version',
ks = 'ks',
veid = '2468',
uic = 1234,
cv1 = null,
cv2 = {cv2: 'cv2'},
Expand Down Expand Up @@ -73,6 +74,7 @@ describe('KavaModel', () => {
model.getClientVer = () => cv;
model.getClientTag = () => ct;
model.getKS = () => ks;
model.getVirtualEventId = () => veid;
model.getUIConfId = () => uic;
model.getCustomVar1 = () => cv1;
model.getCustomVar2 = () => cv2;
Expand Down Expand Up @@ -114,6 +116,7 @@ describe('KavaModel', () => {
clientTag: ct,
position: pos,
ks: ks,
virtualEventId: veid,
uiConfId: uic,
sessionStartTime: sst,
customVar2: cv2,
Expand Down
3 changes: 3 additions & 0 deletions test/src/kava.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ describe('KavaPlugin', function () {
entryType: 'Vod',
sessionId: 'c15be273-0f1b-10a3-4fc9-d7a53eebee85:b66abd37-e2e2-a22e-86ac-7859592e754b',
ks: 'Njk0ZmI4MzBiOTJiMGZhN2NmNTAwYWQyZGM2M2Y0YjkxMGRiZGI3MXwxMDkxOzEwOTE7MTUxNzkyMjgxMzswOzE1MTc4MzY0MTMuMTM4OzA7dmlldzoqLHdpZGdldDoxOzs=',
virtualEventId: '2468',
userId: '1234'
}
},
Expand Down Expand Up @@ -179,6 +180,7 @@ describe('KavaPlugin', function () {
params.sessionId.should.equal(config.session.id);
// params.eventIndex.should.equal(1);
params.ks.should.equal(config.session.ks);
params.virtualEventId.should.equal(config.plugins.kava.virtualEventId);
params.referrer.should.equal(config.plugins.kava.referrer);
params.deliveryType.should.equal('url');
params.playbackType.should.equal('vod');
Expand Down Expand Up @@ -785,6 +787,7 @@ describe('KavaPlugin', function () {
'eventIndex',
'eventType',
'ks',
'virtualEventId',
'partnerId',
'playbackSpeed',
'playTimeSum',
Expand Down

0 comments on commit e9bf239

Please sign in to comment.