Add link-click metrics (#6934)

* Add link-click metrics

* Fix conditional
This commit is contained in:
Paul Frazee
2024-12-03 15:03:22 -08:00
committed by GitHub
parent 79f807dc4f
commit 0c71f8196f
2 changed files with 14 additions and 0 deletions
+10
View File
@@ -2,10 +2,13 @@ import {useCallback} from 'react'
import {Linking} from 'react-native'
import * as WebBrowser from 'expo-web-browser'
import {logEvent} from '#/lib/statsig/statsig'
import {
createBskyAppAbsoluteUrl,
isBskyAppUrl,
isBskyRSSUrl,
isRelativeUrl,
toNiceDomain,
} from '#/lib/strings/url-helpers'
import {isNative} from '#/platform/detection'
import {useModalControls} from '#/state/modals'
@@ -25,6 +28,13 @@ export function useOpenLink() {
url = createBskyAppAbsoluteUrl(url)
}
if (!isBskyAppUrl(url)) {
logEvent('link:clicked', {
domain: toNiceDomain(url),
url,
})
}
if (isNative && !url.startsWith('mailto:')) {
if (override === undefined && enabled === undefined) {
openModal({
+4
View File
@@ -211,6 +211,10 @@ export type LogEvents = {
'starterPack:opened': {
starterPack: string
}
'link:clicked': {
url: string
domain: string
}
'feed:interstitial:profileCard:press': {}
'feed:interstitial:feedCard:press': {}