@boldvideo/bold-js 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -3
- package/dist/index.js +2 -3
- package/package.json +1 -1
- package/src/lib/tracking.ts +3 -4
package/dist/index.cjs
CHANGED
|
@@ -193,7 +193,7 @@ function sendEvent(client, eventName, data, debug) {
|
|
|
193
193
|
vid: (data == null ? void 0 : data.videoId) || void 0,
|
|
194
194
|
vt: data.title,
|
|
195
195
|
vdur: (data == null ? void 0 : data.videoDuration) || void 0,
|
|
196
|
-
time: (data == null ? void 0 : data.
|
|
196
|
+
time: (data == null ? void 0 : data.currentTime) || void 0
|
|
197
197
|
};
|
|
198
198
|
if (debug)
|
|
199
199
|
console.log(`Bold SDK - Logging event '${eventName}'`, payload);
|
|
@@ -207,8 +207,7 @@ function trackEvent(client, userId, options) {
|
|
|
207
207
|
videoId: video.id,
|
|
208
208
|
title: video.title,
|
|
209
209
|
videoDuration: video.duration,
|
|
210
|
-
|
|
211
|
-
timeStamp: event.timeStamp
|
|
210
|
+
currentTime: event.target.currentTime || 0
|
|
212
211
|
});
|
|
213
212
|
if (event.type == "timeupdate") {
|
|
214
213
|
throttledSendEvent(
|
package/dist/index.js
CHANGED
|
@@ -160,7 +160,7 @@ function sendEvent(client, eventName, data, debug) {
|
|
|
160
160
|
vid: (data == null ? void 0 : data.videoId) || void 0,
|
|
161
161
|
vt: data.title,
|
|
162
162
|
vdur: (data == null ? void 0 : data.videoDuration) || void 0,
|
|
163
|
-
time: (data == null ? void 0 : data.
|
|
163
|
+
time: (data == null ? void 0 : data.currentTime) || void 0
|
|
164
164
|
};
|
|
165
165
|
if (debug)
|
|
166
166
|
console.log(`Bold SDK - Logging event '${eventName}'`, payload);
|
|
@@ -174,8 +174,7 @@ function trackEvent(client, userId, options) {
|
|
|
174
174
|
videoId: video.id,
|
|
175
175
|
title: video.title,
|
|
176
176
|
videoDuration: video.duration,
|
|
177
|
-
|
|
178
|
-
timeStamp: event.timeStamp
|
|
177
|
+
currentTime: event.target.currentTime || 0
|
|
179
178
|
});
|
|
180
179
|
if (event.type == "timeupdate") {
|
|
181
180
|
throttledSendEvent(
|
package/package.json
CHANGED
package/src/lib/tracking.ts
CHANGED
|
@@ -16,7 +16,7 @@ type EventData = {
|
|
|
16
16
|
videoId?: string;
|
|
17
17
|
title: string;
|
|
18
18
|
videoDuration?: number;
|
|
19
|
-
|
|
19
|
+
currentTime?: number;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
function sendEvent(
|
|
@@ -35,7 +35,7 @@ function sendEvent(
|
|
|
35
35
|
vid: data?.videoId || undefined,
|
|
36
36
|
vt: data.title,
|
|
37
37
|
vdur: data?.videoDuration || undefined,
|
|
38
|
-
time: data?.
|
|
38
|
+
time: data?.currentTime || undefined,
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
if (debug) console.log(`Bold SDK - Logging event '${eventName}'`, payload);
|
|
@@ -58,8 +58,7 @@ export function trackEvent(
|
|
|
58
58
|
videoId: video.id,
|
|
59
59
|
title: video.title,
|
|
60
60
|
videoDuration: video.duration,
|
|
61
|
-
|
|
62
|
-
timeStamp: event.timeStamp,
|
|
61
|
+
currentTime: (event.target as HTMLMediaElement).currentTime || 0,
|
|
63
62
|
};
|
|
64
63
|
// debounce fast hitting timeupdate event
|
|
65
64
|
if (event.type == "timeupdate") {
|