Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(FEC-11748): adding player events for EP analytics #109

Merged
merged 2 commits into from
Dec 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
model.getVirtualEventId = () => veid;
model.getVirtualEventId = () => void;

Copy link
Contributor Author

@yairans yairans Dec 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
virtualEventId: veid,
virtualEventId: void,

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