Add link-click metrics (#6934)
* Add link-click metrics * Fix conditional
This commit is contained in:
@@ -2,10 +2,13 @@ import {useCallback} from 'react'
|
|||||||
import {Linking} from 'react-native'
|
import {Linking} from 'react-native'
|
||||||
import * as WebBrowser from 'expo-web-browser'
|
import * as WebBrowser from 'expo-web-browser'
|
||||||
|
|
||||||
|
import {logEvent} from '#/lib/statsig/statsig'
|
||||||
import {
|
import {
|
||||||
createBskyAppAbsoluteUrl,
|
createBskyAppAbsoluteUrl,
|
||||||
|
isBskyAppUrl,
|
||||||
isBskyRSSUrl,
|
isBskyRSSUrl,
|
||||||
isRelativeUrl,
|
isRelativeUrl,
|
||||||
|
toNiceDomain,
|
||||||
} from '#/lib/strings/url-helpers'
|
} from '#/lib/strings/url-helpers'
|
||||||
import {isNative} from '#/platform/detection'
|
import {isNative} from '#/platform/detection'
|
||||||
import {useModalControls} from '#/state/modals'
|
import {useModalControls} from '#/state/modals'
|
||||||
@@ -25,6 +28,13 @@ export function useOpenLink() {
|
|||||||
url = createBskyAppAbsoluteUrl(url)
|
url = createBskyAppAbsoluteUrl(url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isBskyAppUrl(url)) {
|
||||||
|
logEvent('link:clicked', {
|
||||||
|
domain: toNiceDomain(url),
|
||||||
|
url,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if (isNative && !url.startsWith('mailto:')) {
|
if (isNative && !url.startsWith('mailto:')) {
|
||||||
if (override === undefined && enabled === undefined) {
|
if (override === undefined && enabled === undefined) {
|
||||||
openModal({
|
openModal({
|
||||||
|
|||||||
@@ -211,6 +211,10 @@ export type LogEvents = {
|
|||||||
'starterPack:opened': {
|
'starterPack:opened': {
|
||||||
starterPack: string
|
starterPack: string
|
||||||
}
|
}
|
||||||
|
'link:clicked': {
|
||||||
|
url: string
|
||||||
|
domain: string
|
||||||
|
}
|
||||||
|
|
||||||
'feed:interstitial:profileCard:press': {}
|
'feed:interstitial:profileCard:press': {}
|
||||||
'feed:interstitial:feedCard:press': {}
|
'feed:interstitial:feedCard:press': {}
|
||||||
|
|||||||
Reference in New Issue
Block a user