Anthony watchman integration #6799
2 changed files with 11 additions and 5 deletions
|
@ -139,7 +139,7 @@ async function sendAndResetWatchmanData(){
|
|||
duration: Math.round(durationInSeconds) * 1000,
|
||||
protocol,
|
||||
player: playerPoweredBy,
|
||||
user_id: Number(userId),
|
||||
user_id: userId.toString(),
|
||||
position: Math.round(timeAtBuffer) ,
|
||||
rel_position: Math.round((timeAtBuffer / (totalDurationInSeconds * 1000)) * 100),
|
||||
};
|
||||
|
@ -198,8 +198,13 @@ const analytics: Analytics = {
|
|||
stopWatchmanInterval();
|
||||
// TODO: clear data here
|
||||
},
|
||||
videoIsPlaying: () => {
|
||||
startWatchmanIntervalIfNotRunning();
|
||||
videoIsPlaying: (isPlaying) => {
|
||||
if(isPlaying){
|
||||
startWatchmanIntervalIfNotRunning();
|
||||
} else {
|
||||
stopWatchmanInterval();
|
||||
}
|
||||
|
||||
},
|
||||
error: (message) => {
|
||||
return new Promise((resolve) => {
|
||||
|
@ -320,8 +325,9 @@ const analytics: Analytics = {
|
|||
}
|
||||
},
|
||||
|
||||
videoStartEvent: (claimId, duration, poweredBy, canonicalUrl, playerFromView, passedUserId) => {
|
||||
videoStartEvent: (claimId, duration, poweredBy, passedUserId, canonicalUrl, playerFromView) => {
|
||||
|
||||
console.log('Video start');
|
||||
userId = passedUserId
|
||||
|
||||
passedPlayer = playerFromView
|
||||
|
|
|
@ -156,7 +156,7 @@ function VideoViewer(props: Props) {
|
|||
|
||||
fetch(source, { method: 'HEAD' }).then((response) => {
|
||||
var playerPoweredBy = response.headers.get('x-powered-by');
|
||||
analytics.videoStartEvent(claimId, timeToStart, playerPoweredBy, claim && claim.canonical_url, player, userId);
|
||||
analytics.videoStartEvent(claimId, timeToStart, playerPoweredBy, userId, claim && claim.canonical_url, player);
|
||||
});
|
||||
|
||||
doAnalyticsView(uri, timeToStart).then(() => {
|
||||
|
|
Loading…
Add table
Reference in a new issue