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

fix(FEC-9247): add userId to kava reports #45

Merged
merged 6 commits into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion flow-typed/types/kava-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ type _KavaConfigObject = {
customVar3?: Object,
applicationVersion?: string,
playbackContext?: string,
tamperAnalyticsHandler?: Function
tamperAnalyticsHandler?: Function,
userId: string
OrenMe marked this conversation as resolved.
Show resolved Hide resolved
};

/**
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 @@ -306,6 +306,9 @@ export function getEventModel(eventObj: KavaEvent, model: KavaModel): Object {
if (model.getApplicationVersion()) {
commonModel.applicationVersion = model.getApplicationVersion();
}
if (model.getUserId()) {
commonModel.userId = model.getUserId();
}
const eventModel = eventObj.getEventModel(model);
return Object.assign(eventModel, commonModel);
}
2 changes: 2 additions & 0 deletions src/kava-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class KavaModel {
flavorParamsId: number = NaN;
networkConnectionType: string;
playerJSLoadTime: ?number = null;
userId: string;
OrenMe marked this conversation as resolved.
Show resolved Hide resolved
getActualBitrate: Function;
getAverageBitrate: Function;
getPartnerId: Function;
Expand All @@ -52,6 +53,7 @@ class KavaModel {
getPlaybackType: Function;
getPlaybackContext: Function;
getApplicationVersion: Function;
getUserId: Function;
getCanPlayTime: Function;

constructor(model?: Object) {
Expand Down
1 change: 1 addition & 0 deletions src/kava.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ class Kava extends BasePlugin {
this._model.getPlaybackType = () => this._getPlaybackType();
this._model.getPlaybackContext = () => this.config.playbackContext;
this._model.getApplicationVersion = () => this.config.applicationVersion;
this._model.getUserId = () => this.config.userId;
}

_getPosition(): number {
Expand Down
4 changes: 3 additions & 1 deletion test/src/kava.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ describe('KavaPlugin', function() {
playlistId: '12345678',
entryType: 'Vod',
sessionId: 'c15be273-0f1b-10a3-4fc9-d7a53eebee85:b66abd37-e2e2-a22e-86ac-7859592e754b',
ks: 'Njk0ZmI4MzBiOTJiMGZhN2NmNTAwYWQyZGM2M2Y0YjkxMGRiZGI3MXwxMDkxOzEwOTE7MTUxNzkyMjgxMzswOzE1MTc4MzY0MTMuMTM4OzA7dmlldzoqLHdpZGdldDoxOzs='
ks: 'Njk0ZmI4MzBiOTJiMGZhN2NmNTAwYWQyZGM2M2Y0YjkxMGRiZGI3MXwxMDkxOzEwOTE7MTUxNzkyMjgxMzswOzE1MTc4MzY0MTMuMTM4OzA7dmlldzoqLHdpZGdldDoxOzs=',
userId: '1234'
}
},
session: {
Expand Down Expand Up @@ -148,6 +149,7 @@ describe('KavaPlugin', function() {
params.clientVer.should.equal(config.plugins.kava.playerVersion);
params.clientTag.should.equal('html5:v' + config.plugins.kava.playerVersion);
params.position.should.exist;
params.userId.should.equal(config.plugins.kava.userId);
}

it('should send IMPRESSION event', done => {
Expand Down