Skip to content

Commit

Permalink
userId function added
Browse files Browse the repository at this point in the history
  • Loading branch information
mlychndnnr committed Jan 9, 2025
1 parent 65c3a50 commit cd07300
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/videotracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class VideoTracker extends Tracker {
* @private
*/
this._lastBufferType = null;
this._userId = null;

options = options || {};
this.setOptions(options);
Expand All @@ -57,6 +58,12 @@ class VideoTracker extends Tracker {
);
}

/* user can set the user Id */

setUserId(userId) {
this._userId = userId;
}

/**
* Set options for the Tracker.
*
Expand Down Expand Up @@ -85,6 +92,7 @@ class VideoTracker extends Tracker {
* @param {DOMObject|string} [tag] Optional DOMElement to save as this.tag. If a string is passed,
* document.getElementById will be called.
*/

setPlayer(player, tag) {
if (this.player || this.tag) this.dispose();

Expand Down Expand Up @@ -433,9 +441,10 @@ class VideoTracker extends Tracker {
att.viewId = this.getViewId();
att.playerName = this.getPlayerName();
att.playerVersion = this.getPlayerVersion();
att["instrumetation.provider"] = this.getInstrumentationProvider();
att["instrumetation.name"] = this.getInstrumentationName();
att["instrumetation.version"] = this.getInstrumentationVersion();
att["instrumentation.provider"] = this.getInstrumentationProvider();
att["instrumentation.name"] = this.getInstrumentationName();
att["instrumentation.version"] = this.getInstrumentationVersion();
att["enduser.id"] = this._userId;

if (type === "customAction") return att;

Expand Down

0 comments on commit cd07300

Please sign in to comment.