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:
parent
6bbf310348
commit
781f1b712e
2 changed files with 8 additions and 1 deletions
|
@ -383,6 +383,8 @@ const analytics: Analytics = {
|
||||||
return 'loaded_markdown';
|
return 'loaded_markdown';
|
||||||
case RENDER_MODES.IMAGE:
|
case RENDER_MODES.IMAGE:
|
||||||
return 'loaded_image';
|
return 'loaded_image';
|
||||||
|
case 'livestream':
|
||||||
|
return 'loaded_livestream';
|
||||||
default:
|
default:
|
||||||
return 'loaded_misc';
|
return 'loaded_misc';
|
||||||
}
|
}
|
||||||
|
@ -480,7 +482,7 @@ function sendPromMetric(name: string, value?: number) {
|
||||||
let url = new URL(SDK_API_PATH + '/metric/ui');
|
let url = new URL(SDK_API_PATH + '/metric/ui');
|
||||||
const params = { name: name, value: value ? value.toString() : '' };
|
const params = { name: name, value: value ? value.toString() : '' };
|
||||||
url.search = new URLSearchParams(params).toString();
|
url.search = new URLSearchParams(params).toString();
|
||||||
return fetch(url, { method: 'post' }).catch(function(error) {});
|
return fetch(url, { method: 'post' }).catch(function (error) {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,11 @@ export default function LivestreamPage(props: Props) {
|
||||||
const [isLive, setIsLive] = React.useState('pending');
|
const [isLive, setIsLive] = React.useState('pending');
|
||||||
const livestreamChannelId = channelClaim && channelClaim.signing_channel && channelClaim.signing_channel.claim_id;
|
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(() => {
|
React.useEffect(() => {
|
||||||
if (!livestreamChannelId) {
|
if (!livestreamChannelId) {
|
||||||
setIsLive(false);
|
setIsLive(false);
|
||||||
|
|
Loading…
Reference in a new issue