send player events as timing events
This commit is contained in:
parent
1adede3a33
commit
31fa714ef5
3 changed files with 13 additions and 6 deletions
|
@ -910,5 +910,12 @@
|
|||
"%claimsInChannel% publishes": "%claimsInChannel% publishes",
|
||||
"%claimsInChannel% publish": "%claimsInChannel% publish",
|
||||
"Publishing": "Publishing",
|
||||
"Update published": "Update published"
|
||||
}
|
||||
"Update published": "Update published",
|
||||
"Delete this file from my computer": "Delete this file from my computer",
|
||||
"Are you sure you'd like to remove %title% from LBRY?": "Are you sure you'd like to remove %title% from LBRY?",
|
||||
"This will increase the overall bid amount for %title%, which will boost its ability to be discovered while active.": "This will increase the overall bid amount for %title%, which will boost its ability to be discovered while active.",
|
||||
"Support %amount% LBC": "Support %amount% LBC",
|
||||
"You deposited %amount% LBC as a support!": "You deposited %amount% LBC as a support!",
|
||||
"/wallet": "/wallet",
|
||||
"LBRY Link": "LBRY Link"
|
||||
}
|
|
@ -130,10 +130,10 @@ const analytics: Analytics = {
|
|||
}
|
||||
},
|
||||
videoStartEvent: (claimId, duration) => {
|
||||
sendGaEvent('Media', 'StartDelay', claimId, duration);
|
||||
sendGaTimingEvent('Media', 'StartDelay', Number((duration * 1000).toFixed(0)), claimId);
|
||||
},
|
||||
videoBufferEvent: (claimId, currentTime) => {
|
||||
sendGaEvent('Media', 'BufferTimestamp', claimId, currentTime);
|
||||
sendGaTimingEvent('Media', 'BufferTimestamp', currentTime * 1000, claimId);
|
||||
},
|
||||
tagFollowEvent: (tag, following, location) => {
|
||||
sendGaEvent(following ? 'Tag-Follow' : 'Tag-Unfollow', tag);
|
||||
|
@ -176,13 +176,14 @@ function sendGaEvent(category, action, label, value) {
|
|||
}
|
||||
}
|
||||
|
||||
function sendGaTimingEvent(category: string, action: string, timeInMs: number) {
|
||||
function sendGaTimingEvent(category: string, action: string, timeInMs: number, label?: string) {
|
||||
if (analyticsEnabled && isProduction) {
|
||||
ReactGA.timing(
|
||||
{
|
||||
category,
|
||||
variable: action,
|
||||
value: timeInMs,
|
||||
...(label ? { label } : {}),
|
||||
},
|
||||
[SECOND_TRACKER_NAME]
|
||||
);
|
||||
|
|
|
@ -222,7 +222,6 @@ function VideoViewer(props: Props) {
|
|||
player.off();
|
||||
}
|
||||
};
|
||||
// include requireRedraw here so the event listener is re-added when we need to manually remove/add the video player
|
||||
}, [player]);
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in a new issue