📈(frontend) add explicit data attributes for key event tracking

PostHog's autocapture is useful, but explicit tracking ensures cleaner, more
focused data. This initial pass targets high-impact actions; we'll iterate as
needed.
This commit is contained in:
lebaudantoine
2024-09-17 12:58:39 +02:00
committed by aleb_the_flash
parent bcd285e368
commit b9bcc45cce
12 changed files with 17 additions and 2 deletions

View File

@@ -44,6 +44,7 @@ export const LaterMeetingDialog = ({
setIsCopied(true) setIsCopied(true)
}} }}
onHoverChange={setIsHovered} onHoverChange={setIsHovered}
data-attr="later-dialog-copy"
> >
{isCopied ? ( {isCopied ? (
<> <>

View File

@@ -45,7 +45,9 @@ export const Home = () => {
<HStack gap="gutter"> <HStack gap="gutter">
{isLoggedIn ? ( {isLoggedIn ? (
<Menu> <Menu>
<Button variant="primary">{t('createMeeting')}</Button> <Button variant="primary" data-attr="create-meeting">
{t('createMeeting')}
</Button>
<RACMenu> <RACMenu>
<MenuItem <MenuItem
className={menuItemRecipe({ icon: true })} className={menuItemRecipe({ icon: true })}
@@ -57,6 +59,7 @@ export const Home = () => {
}) })
) )
}} }}
data-attr="create-option-instant"
> >
<RiAddLine size={18} /> <RiAddLine size={18} />
{t('createMenu.instantOption')} {t('createMenu.instantOption')}
@@ -69,6 +72,7 @@ export const Home = () => {
setLaterRoomId(data.slug) setLaterRoomId(data.slug)
) )
}} }}
data-attr="create-option-later"
> >
<RiLink size={18} /> <RiLink size={18} />
{t('createMenu.laterOption')} {t('createMenu.laterOption')}
@@ -76,7 +80,7 @@ export const Home = () => {
</RACMenu> </RACMenu>
</Menu> </Menu>
) : ( ) : (
<Button variant="primary" href={authUrl()}> <Button variant="primary" href={authUrl()} data-attr="login">
{t('login', { ns: 'global' })} {t('login', { ns: 'global' })}
</Button> </Button>
)} )}

View File

@@ -90,6 +90,7 @@ export const InviteDialog = ({
setIsCopied(true) setIsCopied(true)
}} }}
onHoverChange={setIsHovered} onHoverChange={setIsHovered}
data-attr="share-dialog-copy"
> >
{isCopied ? ( {isCopied ? (
<> <>

View File

@@ -24,6 +24,7 @@ export const ChatToggle = () => {
tooltip={t(tooltipLabel)} tooltip={t(tooltipLabel)}
isSelected={isChatOpen} isSelected={isChatOpen}
onPress={() => toggleChat()} onPress={() => toggleChat()}
data-attr={`controls-chat-${tooltipLabel}`}
> >
<RiChat1Line /> <RiChat1Line />
</ToggleButton> </ToggleButton>

View File

@@ -44,6 +44,7 @@ export const HandToggle = () => {
notifyOtherParticipants(isHandRaised) notifyOtherParticipants(isHandRaised)
toggleRaisedHand() toggleRaisedHand()
}} }}
data-attr={`controls-hand-${tooltipLabel}`}
> >
<RiHand /> <RiHand />
</ToggleButton> </ToggleButton>

View File

@@ -25,6 +25,7 @@ export const LeaveButton = () => {
navigateTo('feedback') navigateTo('feedback')
}) })
}} }}
data-attr="controls-leave"
> >
<RiPhoneFill <RiPhoneFill
style={{ style={{

View File

@@ -73,6 +73,7 @@ export const HandRaisedListItem = ({
size="sm" size="sm"
onPress={() => lowerHandParticipant(participant)} onPress={() => lowerHandParticipant(participant)}
tooltip={t('participants.lowerParticipantHand', { name })} tooltip={t('participants.lowerParticipantHand', { name })}
data-attr="participants-lower-hand"
> >
<RiHand /> <RiHand />
</Button> </Button>

View File

@@ -19,6 +19,7 @@ export const LowerAllHandsButton = ({
fullWidth fullWidth
variant="text" variant="text"
onPress={() => lowerHandParticipants(participants)} onPress={() => lowerHandParticipants(participants)}
data-attr="participants-lower-hands"
> >
{t('participants.lowerParticipantsHand')} {t('participants.lowerParticipantsHand')}
</Button> </Button>

View File

@@ -78,6 +78,7 @@ const MicIndicator = ({ participant }: MicIndicatorProps) => {
? muteParticipant(participant) ? muteParticipant(participant)
: setIsAlertOpen(true) : setIsAlertOpen(true)
} }
data-attr="participants-mute"
> >
{isMuted ? ( {isMuted ? (
<RiMicOffFill color={'gray'} /> <RiMicOffFill color={'gray'} />

View File

@@ -74,6 +74,7 @@ export const ParticipantsList = () => {
onPress={() => (participantsStore.showParticipants = false)} onPress={() => (participantsStore.showParticipants = false)}
aria-label={t('closeButton')} aria-label={t('closeButton')}
tooltip={t('closeButton')} tooltip={t('closeButton')}
data-attr="participants-close"
> >
<RiCloseLine /> <RiCloseLine />
</Button> </Button>

View File

@@ -34,6 +34,7 @@ export const ParticipantsToggle = () => {
tooltip={t(tooltipLabel)} tooltip={t(tooltipLabel)}
isSelected={isParticipantsOpen} isSelected={isParticipantsOpen}
onPress={() => toggleParticipants()} onPress={() => toggleParticipants()}
data-attr={`controls-participants-${tooltipLabel}`}
> >
<RiGroupLine /> <RiGroupLine />
</ToggleButton> </ToggleButton>

View File

@@ -37,6 +37,7 @@ export const ScreenShareToggle = (
maxWidth: '46px', maxWidth: '46px',
maxHeight: '46px', maxHeight: '46px',
}} }}
data-attr={`controls-screenshare-${tooltipLabel}`}
> >
<Div position="relative"> <Div position="relative">
<RiRectangleLine size={28} /> <RiRectangleLine size={28} />