Anthony watchman integration #6799
2 changed files with 21 additions and 32 deletions
|
@ -117,17 +117,7 @@ async function sendAndResetWatchmanData(){
|
||||||
|
|
||||||
var playerToUse = player || passedPlayer;
|
var playerToUse = player || passedPlayer;
|
||||||
|
|
||||||
if(!playerToUse){
|
|
||||||
return console.log('no player to use')
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!userId){
|
|
||||||
return console.log('no user id')
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!timeAtBuffer){
|
|
||||||
timeAtBuffer = Math.round(player.currentTime()) * 1000;
|
timeAtBuffer = Math.round(player.currentTime()) * 1000;
|
||||||
}
|
|
||||||
|
|
||||||
var totalDurationInSeconds = Math.round(player.duration());
|
var totalDurationInSeconds = Math.round(player.duration());
|
||||||
|
|
||||||
|
@ -187,10 +177,6 @@ const analytics: Analytics = {
|
||||||
amountOfBufferEvents = amountOfBufferEvents + 1;
|
amountOfBufferEvents = amountOfBufferEvents + 1;
|
||||||
amountOfBufferTimeInMS = amountOfBufferTimeInMS + data.bufferDuration;
|
amountOfBufferTimeInMS = amountOfBufferTimeInMS + data.bufferDuration;
|
||||||
|
|
||||||
userId = data.userId;
|
|
||||||
claimUrl = claim.canonical_url;
|
|
||||||
playerPoweredBy = data.playerPoweredBy;
|
|
||||||
|
|
||||||
timeAtBuffer = data.timeAtBuffer;
|
timeAtBuffer = data.timeAtBuffer;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -206,6 +192,23 @@ const analytics: Analytics = {
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
videoStartEvent: (claimId, duration, poweredBy, passedUserId, canonicalUrl, playerFromView) => {
|
||||||
|
|
||||||
|
console.log('Video start');
|
||||||
|
userId = passedUserId
|
||||||
|
claimUrl = canonicalUrl
|
||||||
|
playerPoweredBy = poweredBy;
|
||||||
|
|
||||||
|
videoType = player.currentSource().type
|
||||||
|
|
||||||
|
console.log(userId, canonicalUrl, playerPoweredBy);
|
||||||
|
|
||||||
|
passedPlayer = playerFromView
|
||||||
|
|
||||||
|
// TODO: add claim url , userId
|
||||||
|
sendPromMetric('time_to_start', duration);
|
||||||
|
sendMatomoEvent('Media', 'TimeToStart', claimId, duration);
|
||||||
|
},
|
||||||
error: (message) => {
|
error: (message) => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
if (internalAnalyticsEnabled && isProduction) {
|
if (internalAnalyticsEnabled && isProduction) {
|
||||||
|
@ -324,19 +327,6 @@ const analytics: Analytics = {
|
||||||
Lbryio.call('content_tags', 'sync', params);
|
Lbryio.call('content_tags', 'sync', params);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
videoStartEvent: (claimId, duration, poweredBy, passedUserId, canonicalUrl, playerFromView) => {
|
|
||||||
|
|
||||||
console.log('Video start');
|
|
||||||
userId = passedUserId
|
|
||||||
|
|
||||||
passedPlayer = playerFromView
|
|
||||||
playerPoweredBy = poweredBy;
|
|
||||||
claimUrl = canonicalUrl
|
|
||||||
// TODO: add claim url , userId
|
|
||||||
sendPromMetric('time_to_start', duration);
|
|
||||||
sendMatomoEvent('Media', 'TimeToStart', claimId, duration);
|
|
||||||
},
|
|
||||||
adsFetchedEvent: () => {
|
adsFetchedEvent: () => {
|
||||||
sendMatomoEvent('Media', 'AdsFetched');
|
sendMatomoEvent('Media', 'AdsFetched');
|
||||||
},
|
},
|
||||||
|
|
|
@ -134,7 +134,7 @@ function VideoViewer(props: Props) {
|
||||||
//
|
//
|
||||||
// doAnalyticsBuffer(uri, data);
|
// doAnalyticsBuffer(uri, data);
|
||||||
|
|
||||||
fetch(source, { method: 'HEAD' }).then((response) => {
|
fetch(source, { method: 'HEAD', cache: 'no-store' }).then((response) => {
|
||||||
data.playerPoweredBy = response.headers.get('x-powered-by');
|
data.playerPoweredBy = response.headers.get('x-powered-by');
|
||||||
doAnalyticsBuffer(uri, data, this);
|
doAnalyticsBuffer(uri, data, this);
|
||||||
});
|
});
|
||||||
|
@ -152,12 +152,11 @@ function VideoViewer(props: Props) {
|
||||||
timeToStart += differenceToAdd;
|
timeToStart += differenceToAdd;
|
||||||
}
|
}
|
||||||
analytics.playerStartedEvent(embedded);
|
analytics.playerStartedEvent(embedded);
|
||||||
// TODO: add userId, claim URL,
|
|
||||||
|
|
||||||
fetch(source, { method: 'HEAD' }).then((response) => {
|
fetch(source, { method: 'HEAD', cache: 'no-store' }).then((response) => {
|
||||||
var playerPoweredBy = response.headers.get('x-powered-by');
|
var playerPoweredBy = response.headers.get('x-powered-by');
|
||||||
analytics.videoStartEvent(claimId, timeToStart, playerPoweredBy, userId, claim && claim.canonical_url, player);
|
analytics.videoStartEvent(claimId, timeToStart, playerPoweredBy, userId, claim && claim.canonical_url, player);
|
||||||
});
|
})
|
||||||
|
|
||||||
doAnalyticsView(uri, timeToStart).then(() => {
|
doAnalyticsView(uri, timeToStart).then(() => {
|
||||||
claimRewards();
|
claimRewards();
|
||||||
|
|
Loading…
Reference in a new issue