GA: entered livestream (#364)

## Issue
85: "user joined livestream"

## Approach
Add it into the existing "player :: action" event, so we can compare it againts `loaded_video | loaded_image | loaded_markdown | loaded_audio`.
This commit is contained in:
infinite-persistence 2021-11-24 08:03:21 -08:00 committed by GitHub
parent 6bbf310348
commit 781f1b712e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -383,6 +383,8 @@ const analytics: Analytics = {
return 'loaded_markdown';
case RENDER_MODES.IMAGE:
return 'loaded_image';
case 'livestream':
return 'loaded_livestream';
default:
return 'loaded_misc';
}
@ -480,7 +482,7 @@ function sendPromMetric(name: string, value?: number) {
let url = new URL(SDK_API_PATH + '/metric/ui');
const params = { name: name, value: value ? value.toString() : '' };
url.search = new URLSearchParams(params).toString();
return fetch(url, { method: 'post' }).catch(function(error) {});
return fetch(url, { method: 'post' }).catch(function (error) {});
}
}

View file

@ -23,6 +23,11 @@ export default function LivestreamPage(props: Props) {
const [isLive, setIsLive] = React.useState('pending');
const livestreamChannelId = channelClaim && channelClaim.signing_channel && channelClaim.signing_channel.claim_id;
React.useEffect(() => {
// TODO: This should not be needed one we unify the livestream player (?)
analytics.playerLoadedEvent('livestream', false);
}, []);
React.useEffect(() => {
if (!livestreamChannelId) {
setIsLive(false);