Merge pull request #34644 from overleaf/as-link-sharing-analytics

[web] Add sharing link analytics events

GitOrigin-RevId: b206732397065c399d38a8e42dbdebe60222fb24
This commit is contained in:
MoxAmber
2026-06-18 08:06:52 +00:00
committed by Copybot
parent ad9b28af18
commit a3036730b4
2 changed files with 19 additions and 1 deletions
@@ -5,6 +5,7 @@ import { useProjectContext } from '@/shared/context/project-context'
import { useUserContext } from '@/shared/context/user-context'
import { debugConsole } from '@/utils/debugging'
import getMeta from '@/utils/meta'
import { sendMB } from '@/infrastructure/event-tracking'
export default function CopySharingLinkButton() {
const { t } = useTranslation()
@@ -31,7 +32,12 @@ export default function CopySharingLinkButton() {
navigator.clipboard
.writeText(link)
.then(() => setSuccessActionMessage(t('link_copied')))
.then(() => {
setSuccessActionMessage(t('link_copied'))
sendMB('sharing-link-copied', {
project_id: projectId,
})
})
.catch(debugConsole.error)
}
@@ -30,6 +30,7 @@ import {
import { ExcludeStrict } from '@ol-types/utils'
import getMeta from '@/utils/meta'
import { useFeatureFlag } from '@/shared/context/split-test-context'
import { sendMB } from '@/infrastructure/event-tracking'
type ProjectAccessProps = {
setIsInvitedPeopleScreen: React.Dispatch<React.SetStateAction<boolean>>
@@ -95,6 +96,11 @@ function ProjectAccess({
setSharingLinkData(data)
setProjectAccess(newAccess)
setSuccessActionMessage(t('access_updated'))
sendMB('sharing-link-set-permissions', {
project_id: projectId,
access_level: newAccess.split('.')[0],
...reqBody,
})
})
}
@@ -122,6 +128,12 @@ function ProjectAccess({
).then(data => {
setSharingLinkData(data)
setSuccessActionMessage(t('access_updated'))
sendMB('sharing-link-set-permissions', {
project_id: projectId,
access_level: projectAccess?.split('.')[0],
privileges: eventKey,
subscriptionId: data.subscriptionId,
})
})
}